REXML + Gruff: display label problem

L

Luc Juggery

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top