REXML + Gruff: display label problem

Hello All,

I have a little question regarding graph configuration for Gruff
I googled this problem but didnot find anything…
I am using REXML and gruff to create a graph from XML file.
That is working fine except the fact that the x labels are quite
unreadable.
Do you know if there is a way in gruff to display the x-axis label
verticaly so that they do not overlap each over ?

This is the code I use:


require ‘rexml/document’
require ‘rubygems’
require ‘gruff’
include REXML

file = File.new(“users.xml”)
doc = Document.new(file)
root=doc.root
user_number = [];
date_label = {};
count=0
root.each_element(’//date’) do |date|
user_number.push(date.elements[‘user_number’].attributes[‘value’].to_i)
label = date.attributes[‘value’]
date_label[count]=label.split(" ")[0] if /12:00$/.match(label)
count = count+1
end
g = Gruff::Line.new
g.data(“Users number”, user_number)
g.labels = date_label
g.write(‘user_trend.png’)

Thanks a lot,

Luc

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs