highcharts - High Chart to High Stock -
i wish doing great.
i confuse "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 chart without problems, create high stock, , begins doubt.
how can put these series , these values in high stock?
remembering have json , not want go on page, since have available high chart.
i tried examples, i'm confused.
i grateful help.
below can see example using.
$(function () { var seriesoptions = [], seriescounter = 0, names = ['msft', 'aapl', 'goog'], // create chart when data 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 }; // we're loading data asynchronously, don't know order arrive. // keep counter , create chart when data loaded. seriescounter += 1; if (seriescounter === names.length) { createchart(); } }); }); });
have included highstock.js file?
<script src="http://code.highcharts.com/stock/highstock.js"></script>
i find it's easier test , build examples js fiddle examples. for example.
Comments
Post a Comment