lib/SVG/Graph/BarBase.rb in svg-graph-2.0.2.beta vs lib/SVG/Graph/BarBase.rb in svg-graph-2.0.2
- old
+ new
@@ -38,9 +38,16 @@
# transparent colors, :top stacks bars on top of one another,
# :side stacks the bars side-by-side. Defaults to :overlap.
attr_accessor :stack
protected
+ # space in px between x-labels, we override the Graph version because
+ # we need the extra space (i.e. don't subtract 1 from get_x_labels.length)
+ def field_width
+ # don't use -1 otherwise bar is out of bounds
+ @graph_width.to_f / ( get_x_labels.length )
+ end
+
def max_value
@data.collect{|x| x[:data].max}.max
end
def min_value