def draw_data
line = 1
x_min, x_max, x_div = x_range
y_min, y_max, y_div = y_range
x_step = (@graph_width.to_f - font_size*2) / (x_max-x_min)
y_step = (@graph_height.to_f - font_size*2) / (y_max-y_min)
for data in @data
x_points = data[:data][X]
y_points = data[:data][Y]
lpath = "L"
x_start = 0
y_start = 0
x_points.each_index { |idx|
x = (x_points[idx] - x_min) * x_step
y = @graph_height - (y_points[idx] - y_min) * y_step
x_start, y_start = x,y if idx == 0
lpath << "#{x} #{y} "
}
if area_fill
@graph.add_element( "path", {
"d" => "M#{x_start} #@graph_height #{lpath} V#@graph_height Z",
"class" => "fill#{line}"
})
end
@graph.add_element( "path", {
"d" => "M#{x_start} #{y_start} #{lpath}",
"class" => "line#{line}"
})
if show_data_points || show_data_values
x_points.each_index { |idx|
x = (x_points[idx] - x_min) * x_step
y = @graph_height - (y_points[idx] - y_min) * y_step
if show_data_points
@graph.add_element( "circle", {
"cx" => x.to_s,
"cy" => y.to_s,
"r" => "2.5",
"class" => "dataPoint#{line}"
})
add_popup(x, y, format( x_points[idx], y_points[idx] )) if add_popups
end
make_datapoint_text( x, y-6, y_points[idx] ) if show_data_values
}
end
line += 1
end
end