lilygraph 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/lilygraph.rb +16 -13
- data/lilygraph.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.4
|
data/lib/lilygraph.rb
CHANGED
@@ -203,23 +203,26 @@ class Lilygraph
|
|
203
203
|
if @options[:bar_text]
|
204
204
|
last_bar_height = false
|
205
205
|
data.each_with_index do |number, number_index|
|
206
|
-
|
206
|
+
if number > 0
|
207
|
+
height = ((dy / 10.0) * number).round
|
207
208
|
|
208
|
-
|
209
|
-
|
209
|
+
bar_x = (x + ((dx - width) / 2.0) + (number_index * bar_width)).round
|
210
|
+
text_x = (bar_x + (bar_width / 2.0)).round
|
210
211
|
|
211
|
-
|
212
|
-
|
212
|
+
bar_y = @options[:viewbox][:height] - @options[:margin][:bottom] - height
|
213
|
+
text_y = bar_y - 3
|
213
214
|
|
214
|
-
|
215
|
-
|
216
|
-
|
215
|
+
if last_bar_height && (last_bar_height - height).abs < 14
|
216
|
+
text_y -= (14 - (height - last_bar_height))
|
217
|
+
last_bar_height = false
|
218
|
+
else
|
219
|
+
last_bar_height = height
|
220
|
+
end
|
221
|
+
|
222
|
+
xml.text number, :x => text_x, :y => text_y, 'text-anchor' => 'middle'
|
217
223
|
else
|
218
|
-
last_bar_height =
|
224
|
+
last_bar_height = false
|
219
225
|
end
|
220
|
-
|
221
|
-
# xml.text number, :x => text_x, :y => text_y + 1, 'text-anchor' => 'middle', 'font-size' => '13px', 'stroke-width' => 1.0, :fill => '#ffffff', :stroke => '#ffffff'
|
222
|
-
xml.text number, :x => text_x, :y => text_y, 'text-anchor' => 'middle'
|
223
226
|
end
|
224
227
|
end
|
225
228
|
end
|
@@ -228,7 +231,7 @@ class Lilygraph
|
|
228
231
|
# Legend
|
229
232
|
if @legend
|
230
233
|
legend_x = @options[:viewbox][:width] - (3 * @options[:margin][:right])
|
231
|
-
legend_y = @options[:margin][:top] / 2
|
234
|
+
legend_y = (@options[:margin][:top] / 2) + @options[:margin][:top]
|
232
235
|
xml.rect :fill => '#ffffff', :stroke => '#000000', 'stroke-width' => 2, :x => legend_x, :y => legend_y, :width => (2.5 * @options[:margin][:right]), :height => (@legend.size * 15) + 16
|
233
236
|
|
234
237
|
@legend.sort.each_with_index do |data, index|
|
data/lilygraph.gemspec
CHANGED