javascript - How can i keep the color the same in highcharts -
i using highcharts first time. looks cool , doing want. use piechart , refresh data every second. working color of pieces changing every second. how can keep same color?
this code
var chart; $(document).ready(function() { chart = new highcharts.chart({ chart: { renderto: 'container', plotbackgroundcolor: null, animation: false, plotborderwidth: null, plotshadow: false, events: { load: function() { // set updating of chart each second var series = this.series[0]; setinterval(function() { $.getjson("opencont.php", function (data) { $.each(data.vragen, function (index, value) { series.addpoint([value.short, value.antwoorden], true, true); }) }) }, 1000); } } }, title: { text: '' }, tooltip: { formatter: function() { return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %'; } }, plotoptions: { pie: { allowpointselect: true, cursor: 'pointer', datalabels: { enabled: true, color: '#000000', connectorcolor: '#000000', formatter: function() { return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %'; } } } }, series: [{ type: 'pie', name: 'browser share', data: [ ['a', 0], ['b', 0], ['c', 0] ] }] }); });
do want add new points pie chart, or want replace existing points new values?
if it's later, might want @ series setdata method. example @ http://jsfiddle.net/ebuts/22/
Comments
Post a Comment