def draw_y_labels
stagger = y_label_font_size + 5
if show_y_labels
label_height = field_height
count = 0
y_offset = @graph_height + y_label_offset( label_height )
y_offset += font_size/1.2 unless rotate_y_labels
for label in get_y_labels
y = y_offset - (label_height * count)
x = rotate_y_labels ? 0 : -3
if stagger_y_labels and count % 2 == 1
x -= stagger
@graph.add_element( "path", {
"d" => "M#{x} #{y} h#{stagger}",
"class" => "staggerGuideLine"
})
end
text = @graph.add_element( "text", {
"x" => x.to_s,
"y" => y.to_s,
"class" => "yAxisLabels"
})
text.text = label.to_s
if rotate_y_labels
text.attributes["transform"] = "translate( -#{font_size} 0 ) "+
"rotate( 90 #{x} #{y} ) "
text.attributes["style"] = "text-anchor: middle"
else
text.attributes["y"] = (y - (y_label_font_size/2)).to_s
text.attributes["style"] = "text-anchor: end"
end
draw_y_guidelines( label_height, count ) if show_y_guidelines
count += 1
end
end
end