I am implementing Line graph. I want to have labels just above every
dots inside graph. Please help me to implement.
require ‘rubygems’
require ‘gruff’
graph = Gruff::Line.new(“594x384”)
graph.theme = {
:marker_color => ‘#aaa’,
:background_colors => [’#ffffff’, ‘#fff’]
}
graph.y_axis_increment = 100
graph.replace_colors([’#999999’,’#bbd65b’,‘green’])
graph.data(“first”,
[100,190,110,230,460,400,550,450,620,300,470,140,1000])
graph.data(“second”, [400,500,420,580,580,680,830,500,900,600])
graph.legend_font_size = 15
graph.marker_font_size = 15
graph.title_font_size = 15
graph.line_width = 2
graph.dot_radius = 3
graph.labels = {
0 => ‘12AM’,
2 => ‘4AM’,
4 => ‘8AM’,
6 => ‘12PM’,
8 => ‘4PM’,
10 => ‘8PM’,
}
graph.minimum_value = 0
graph.y_axis_label= “Number of Impressions”
graph.x_axis_label= “Time”
graph.write(‘my_graph.png’)