views:

41

answers:

2

I am able to create a time-series "hash" using the statistics gem:

=> #<OrderedHash {"2010-10-23"=>2, "2010-09-22"=>3, "2010-09-11"=>1, "2010-08-27"=>1, "2010-10-15"=>
1, "2010-09-15"=>1, "2010-08-08"=>2, "2010-10-17"=>14, "2010-10-06"=>2, "2010-09-28"=>1, "2010-10-19
"=>1, "2010-09-20"=>1}>

I want to create a simple graph with this data -- I am trying to use the Seer gem but am confused -- it looks like rather than passing in a series, you pass in a method and it runs it live based on the data.

Is there a way I can take data starting with a hash and display it?

A: 

I have used highcarts. It is a javascript library but it's really easy to use. Use ruby to get your statistics and then display them with this library.

It does not matter if the data is in a hash or an array. It depends what kinda graph you want. Looking at your data you could just create a line graph. the x-axis would be the time and the y-axis would be the amount.

Then you can just loop over the hash and for each value have the key as the y-value and the value as the x-value.

You will have to create a different hash for each type of data you wanted to store.

Sam
Seems like people are really suggesting highcharts...I came across seer and thought that would work better because it uses Google API...although maybe from an ease of use, highcarts is better?
Angela
I don't know if it is better. I have used highcharts and it was pretty awesome. If you need help getting an example together just let me know and we can use git to get an example up and going for you
Sam
okay super --- I guess I'd like to just pass the hash directly in....I guess when reading it I still don't see how to pass a hash -- looks like it needs an array -- but the example isn't clear on how to do a time-series....any ideas?
Angela
If you project is not too big you can put in on github and we can do it together. That might be overkill, whatever you decide. You are using the statistics gem. Anything else that you are using that is important to consider?
Sam
A: 

Google Charts (http://code.google.com/apis/chart/) is another option, although I have to say that HighCharts looks pretty impressive.

monch1962