lib/lilygraph.rb in lilygraph-0.5.6 vs lib/lilygraph.rb in lilygraph-0.5.7
- old
+ new
@@ -20,10 +20,11 @@
:indent => 2,
:padding => 14,
:legend => :right,
:bar_text => :number,
:type => :bar,
+ :padding => false,
:viewbox => {
:width => 800,
:height => 600
},
:margin => { :top => 50, :left => 50, :right => 50, :bottom => 100 }
@@ -297,10 +298,16 @@
def division
[(10 ** Math.log10(data_max).floor), 1].max
end
def max
- (((data_max + [division / 10, 1].max) / Float(division)).ceil * Float(division)).round
+ if @options[:padding]
+ temp_max = (data_max + [division / 10, 1].max)
+ else
+ temp_max = data_max
+ end
+
+ ((temp_max / Float(division)).ceil * Float(division)).round
end
def graph_height
@options[:viewbox][:height] - (@options[:margin][:top] + @options[:margin][:bottom])
end