def draw_line_markers
return if @hide_line_markers
@d = @d.stroke_antialias false
if @y_axis_increment.nil?
if @marker_count.nil?
(3..7).each do |lines|
if @spread % lines == 0.0
@marker_count = lines
break
end
end
@marker_count ||= 4
end
@increment = (@spread > 0 && @marker_count > 0) ? significant(@spread / @marker_count) : 1
else
@marker_count = (@spread / @y_axis_increment).to_i
@increment = @y_axis_increment
end
@increment_scaled = @graph_height.to_f / (@spread / @increment)
(0..@marker_count).each do |index|
y = @graph_top + @graph_height - index.to_f * @increment_scaled
@d = @d.fill(@marker_color)
y += 0.001 unless defined?(JRUBY_VERSION)
@d = @d.line(@graph_left, y, @graph_right, y)
unless @marker_shadow_color.nil?
@d = @d.fill(@marker_shadow_color)
@d = @d.line(@graph_left, y + 1, @graph_right, y + 1)
end
marker_label = BigDecimal(index.to_s) * BigDecimal(@increment.to_s) +
BigDecimal(@minimum_value.to_s)
unless @hide_line_numbers
@d.fill = @font_color
@d.font = @font if @font
@d.stroke('transparent')
@d.pointsize = scale_fontsize(@marker_font_size)
@d.gravity = EastGravity
@d = @d.annotate_scaled(@base_image,
@graph_left - LABEL_MARGIN, 1.0,
0.0, y,
label(marker_label, @increment), @scale)
end
end
@d = @d.stroke_antialias true
end