Trouble putting JSON into a Rickshaw Graph on Dashing

519 Views Asked by At

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}]
1

There are 1 best solutions below

0
On

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}]