0

I am generating a bar chart with values [1,5,10,23]. Currently, I have no way of knowing those exact values when looking at the image generated by Gruff. I just know that 23 falls somewhere between the lines of 20 and 25.

Is it possible to write the exact values within the image?

Luigi
  • 5,443
  • 15
  • 54
  • 108

2 Answers2

1

I think you are looking for labels

g = Gruff::Bar.new
g.title = 'Wow!  Look at this!'
g.data = "something", [1,5,10,23]
g.labels = { 0 => '1', 1 => '5', 2 => '10', 3 => '23'}

Read the documentation for more info on labels

usha
  • 28,973
  • 5
  • 72
  • 93
  • I was hoping there was something I could use to write the "labels" above the bars, within the image. Not necessarily as a label on the bottom of the graph. I do think I can make this work though if there is no other option, so thanks for the direction. – Luigi Oct 17 '13 at 20:47
0

I think this is what you are looking for:

g.show_labels_for_bar_values = true
Pang
  • 9,564
  • 146
  • 81
  • 122
rtmex
  • 1
  • 3