I'd like to plot a line chart with (x,y) data for several different series on the same chart. I'd like to populate the chart with JSON data so that it can automatically update itself with some AJAX. I'm struggling with the TeeChart documentation as to how to format the JSON.
I've been able to get my chart to display with one series, using the following code:
Code: Select all
// This example works with one data series
//require teechart.js
//require teechart-table.js
var chart_recorder_performance = new Tee.Chart("canvas_recorder_performance");
//some example data which will eventually be retrieved with an AJAX call instead
data = {
"series": {
"point": [
{ "name": "2012-12-14", "value": 53 },
{ "name": "2012-12-15", "value": 52 },
{ "name": "2012-12-16", "value": 50 }
]
}
};
chart_recorder_performance.addSeries(new Tee.Line()).loadJSON( { value:JSON.stringify(data) } );
chart_recorder_performance.draw();
So this does not work:
Code: Select all
// This example does not work with two data series
//require teechart.js
//require teechart-table.js
var chart_recorder_performance = new Tee.Chart("canvas_recorder_performance");
//some multi-series example data which will eventually be retrieved with an AJAX call instead
data = {
"series1": {
"point": [
{ "name": "2012-12-14", "value": 53 },
{ "name": "2012-12-15", "value": 52 },
{ "name": "2012-12-16", "value": 50 }
]
},
"series2": {
"point": [
{ "name": "2012-12-13", "value": 30 },
{ "name": "2012-12-14", "value": 43 },
{ "name": "2012-12-15", "value": 43 },
{ "name": "2012-12-16", "value": 42 },
{ "name": "2012-12-17", "value": 40 }
]
}
};
chart_recorder_performance.addSeries(new Tee.Line()).loadJSON( { value:JSON.stringify(data) } );;
chart_recorder_performance.draw();
Thanks in advance,
Martyn Whitwell.