1

I'm trying to create a dashing dashboard based on some JSON data; however, I can't find a widget that supports these types of data sets (specifically using dates on the x-axis). I've tried Rickshaw but no luck.

Any suggestions?

Sample data:

[{"day"=>"2014-01-22", "users"=>120}, {"day"=>"2014-01-23", "users"=>130}, {"day"=>"2014-01-24", "users"=>110}, {"day"=>"2014-01-25", "users"=>175}]
devpreneur
  • 139
  • 1
  • 9
  • cant you just manually parse the data and use the array in ruby? – Tom Prats Jan 25 '14 at 06:27
  • Mainly I'm wondering how to use dates as the x-axis. So far all the examples I've seen are using integers. I'm trying to plot the last x-days worth of data over time. Do I need to convert dates into day 0, day 1, etc? – devpreneur Jan 25 '14 at 19:35

1 Answers1

0

Taken from the Rickshaw documentation

Note that the x values are interpreted as unix timestamps. Data can also be passed as full-on Rickshaw-style series.

This means you are providing wrong (as strings) the x axis values when you should provide them as Unix timestamps (as Integer). Also you must stick to x and y tuples syntax for the points.

Something like this JSON worked good for me for painting dates on X axis:

[{:x=>1430085600, :y=>0}, {:x=>1430172000, :y=>0}, {:x=>1430258400, :y=>11}, {:x=>1430344800, :y=>0}, {:x=>1430431200, :y=>0}, {:x=>1430517600, :y=>0}, {:x=>1430604000, :y=>0}, {:x=>1430690400, :y=>4}]
Jorge Diaz
  • 2,503
  • 1
  • 14
  • 15