Skip to content

Commit 02d7243

Browse files
committed
Candlestick: Fix graph width calculation
1 parent e98e42d commit 02d7243

6 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/gruff/candlestick.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def draw_graph
8181
minimum_value: minimum_value, maximum_value: maximum_value, spread: @spread
8282
)
8383

84-
width = (@graph_width - calculate_spacing) / column_count
84+
width = @graph_width / calculate_spacing
8585
bar_width = width * @spacing_factor
8686
padding = width - bar_width
8787

@@ -115,9 +115,9 @@ def column_count
115115
normalized_candlesticks.size
116116
end
117117

118-
# @rbs return: Integer
118+
# @rbs return: Float
119119
def calculate_spacing
120-
column_count - 1
120+
column_count.to_f
121121
end
122122

123123
# @rbs return: bool

sig/generated/gruff/candlestick.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class Gruff::Candlestick < Gruff::Base
5858
# @rbs return: Integer
5959
def column_count: () -> Integer
6060

61-
# @rbs return: Integer
62-
def calculate_spacing: () -> Integer
61+
# @rbs return: Float
62+
def calculate_spacing: () -> Float
6363

6464
# @rbs return: bool
6565
def show_marker_vertical_line?: () -> bool

test/expected/candlestick.png

155 Bytes
Loading
-138 Bytes
Loading
4.26 KB
Loading
-416 Bytes
Loading

0 commit comments

Comments
 (0)