highcharts - Add Flag based on button event -
series: [{ type: 'flags', name: 'flags on axis', data: [{ x: date.utc(2011, 2, 1), title: 'a' }, { x: date.utc(2011, 5, 1), title: 'c' }], shape: 'squarepin' }] $("#btnaddflag").click(function () { chart.series[0].setdata( { x: date.utc(2011, 2, 1), title: 'b' }); });
above code part of highstock chart option , want add flag based on user event click. able add new point flag chart existing flags title , c missed out.
how can add new flag chart existing flags ?
on other hand, able flag data i'm unsure generate correct data structure , reinitialize old , new flag data chart.
thank you.
use addpoint instead of setdata.
http://api.highcharts.com/highstock#series.addpoint()
$("#btnaddflag").click(function () { chart.series[0].addpoint({ x: date.utc(2011, 2, 1), title: 'b' }); });
Comments
Post a Comment