I wish everybody is doing great.
I am really confuse with this "High Chart".
My data:
string '[{"name":"Line001","data":[1,2,3,4]},
{"name":"Line002","data":[1,2,3,4]},
{"name":"Line003","data":[1,2,3,4]},
{"name":"Line004","data":[1,2,3,4]}]'
xAxis = [2000,2001,2002,2003];
I can create the chart without problems, but I would like to create a High Stock, and then begins THE doubt.
How can I put these series and these values in a High Stock?
Remembering that I already have the JSON and I do not want to go on another page, since I already have it available for the High Chart.
I tried examples, but I'm really confused.
I will be very grateful for the help.
Below you can see the example I am using.
$(function () {
var seriesOptions = [],
seriesCounter = 0,
names = ['MSFT', 'AAPL', 'GOOG'],
// create the chart when all data is loaded
createChart = function () {
$('#container').highcharts('StockChart', {
rangeSelector: {
selected: 4
},
yAxis: {
labels: {
formatter: function () {
return (this.value > 0 ? ' + ' : '') + this.value + '%';
}
},
plotLines: [{
value: 0,
width: 2,
color: 'silver'
}]
},
plotOptions: {
series: {
compare: 'percent'
}
},
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.change}%)<br/>',
valueDecimals: 2
},
series: seriesOptions
});
};
$.each(names, function (i, name) {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=' + name.toLowerCase() + '-c.json&callback=?', function (data) {
seriesOptions[i] = {
name: name,
data: data
};
// As we're loading the data asynchronously, we don't know what order it will arrive. So
// we keep a counter and create the chart when all the data is loaded.
seriesCounter += 1;
if (seriesCounter === names.length) {
createChart();
}
});
});
});