Reputation: 216
.Hi, first, sorry for my english ;)
So, i need to put multiple JSON in my highstock. I use the "basic line" for the moment, can i put multiple lines in this one or i have to choose another highstock like this one?... but i don't understand how it works.
My first data.js :
[[1362133360000,25],[1362136955000,14],[1362140579000,35],[1362144175000,21],[1362146967000,15],[1362150567000,16],[1362154351000,15],[1362157951000,12],[1362161559000,16],[1362164400000,11],[1362171600000,15],[1362174626000,18]]
My second data2.js :
[[1362133360000,12],[1362136955000,10],[1362140579000,30],[1362144175000,18],[1362146967000,10],[1362150567000,10],[1362154351000,10],[1362157951000,8],[1362161559000,11],[1362164400000,5],[1362171600000,10],[1362174626000,14]]
My highstocks works with one file, is like that, so, i need to have 1 line for data.json and another one for data2.json .
Thank you !
Upvotes: 0
Views: 778
Reputation: 12238
You can have multiple series on a line chart.
series: [{
name: 'series1',
data: data1,
},{
name: 'series2',
data: data2,
}]
data1 would contain JSON from data.js, and data2 would contain JSON from data2.js.
So you could do something like this given your data structure:
$.getJSON('data.js', function (data1) {
$.getJSON('data2.js', function (data2) {
$('#container').highcharts('StockChart', {
series: [{
name: 'series1',
data: data1,
}, {
name: 'series2',
data: data2,
}
]
});
});
});
Upvotes: 1