def draw_titles
if show_graph_title
@root.add_element( "text", {
"x" => (width / 2).to_s,
"y" => (title_font_size).to_s,
"class" => "mainTitle"
}).text = graph_title.to_s
end
if show_graph_subtitle
y_subtitle = show_graph_title ?
title_font_size + 10 :
subtitle_font_size
@root.add_element("text", {
"x" => (width / 2).to_s,
"y" => (y_subtitle).to_s,
"class" => "subTitle"
}).text = graph_subtitle.to_s
end
if show_x_title
y = @graph_height + @border_top + x_title_font_size
if show_x_labels
y += x_label_font_size + 5 if stagger_x_labels
y += x_label_font_size + 5
end
x = width / 2
@root.add_element("text", {
"x" => x.to_s,
"y" => y.to_s,
"class" => "xAxisTitle",
}).text = x_title.to_s
end
if show_y_title
x = y_title_font_size + (y_title_text_direction==:bt ? 3 : -3)
y = height / 2
text = @root.add_element("text", {
"x" => x.to_s,
"y" => y.to_s,
"class" => "yAxisTitle",
})
text.text = y_title.to_s
if y_title_text_direction == :bt
text.attributes["transform"] = "rotate( -90, #{x}, #{y} )"
else
text.attributes["transform"] = "rotate( 90, #{x}, #{y} )"
end
end
end