Reputation: 3
I am trying to graph 2 series on the same graph and not having much luck. The series data is coming from a mysql php backend (json).
An example of the json output is below;
[
{
"name": [
"Outside Temperature"
],
"data": [
"1362992572,9.708",
"1362992752,9.948",
"1362992936,9.995",
"1362993292,10.19"
]
},
{
"name": "inside",
"data": [
"1362992572,30",
"1362992752,30.5",
"1362992933,30.7",
"1362993112,30.8",
"1362993292,30.4"
]
}
]
I have the following in my highcharts code - http://pastebin.com/BxQxhJmZ however this does not even generate a graph.
If anyone can assist it would be greatly appreciated. I'm really stumped on how to do something relatively simple by graphing two sets of data!
Upvotes: 0
Views: 1993
Reputation: 37578
In case when you use datetime xAxis, then you need to multiply your values like (1362992572) by 1000, to achive Javascript timestamp format.
Upvotes: 1
Reputation: 19093
I think your data is formatted incorrectly. I would expect it to look more like:
"data": [ [1362992572,9.708], [1362992752,9.948], [1362992936,9.995], [1362993292,10.19] ]
or
"data": [
{x:1362992572,y:9.708},
{x:1362992752,y:9.948},
{x:1362992936,y:9.995},
{x:1362993292,y:10.19}
]
If you can, change it in your php backend. If not, you will have to reformat it in javascipt, splitting the string values into two fields on the comma.
Upvotes: 0