What is wrong with my json data here?
-
12-09-2019 - |
Question
I'm just doing a simple graph using Open Flash Chart http://teethgrinder.co.uk/open-flash-chart/ which shows the visits on my site.
I have produced the following json data but I'm getting back a syntax error from this:
&title=Traffic,{font-size: 20px; color: #736AFF}&
&x_label_style=10,0x000000,0,2&
&x_axis_steps=1&
&y_legend=Number,12,#736AFF&
&y_ticks=5,10,4&
&line=2,0x9933CC,Page views,10&
&values=3,2,0,1,0,0,3,0,0,1,1,2,45,4,0,0,0,0,0,32,5,0,0,0,0,0,0,0,0,0,0&
&x_labels=30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1&
&y_min=0&
&y_max=45&
Basically I'm just hoping to produce a single line on this graph. The data looks Okay to me but obviously something is wrong.
Any ideas?
Solution
You're using the wrong version of the charting software.
1.0 Has its own arbitrary data format like that you pasted, and 2.0 has JSON, which is unlike that which you pasted.
You'll see in the tutorial for 2.0 That there is an example JSON code which your output needs to emulate.
If you're stuck using 1.0 [tutorial] ,then you need to use the 1.0 format
OTHER TIPS
Um, are you sure your paste hasn't been corrupted?
The JSON grammar is (basically)
Expression ::= Primitive | Object | Array
Primitive ::= Number | Boolean | String | null
Object ::= {} | {String : Exression (, String : Exression)*}
Array ::= [] | [Expression (, Expression)*]
Eg. the &'s etc in the json that you have posted are bogus -- unless i'm missing some detail about what/how your sending the JSON.