我第一次使用highcharts。它看起來很酷,它幾乎正在做我想要的。我使用一個餅圖並每秒刷新一次數據。這只是工作,只是顏色的片斷每秒都在變化。我怎樣才能保持相同的顏色?我如何在高圖中保持顏色相同
這是我的代碼
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
plotBackgroundColor: null,
animation: false,
plotBorderWidth: null,
plotShadow: false,
events: {
load: function() {
// set up the updating of the 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]
]
}]
});
});
它已經在這裏找到答案http://stackoverflow.com/questions/17802509/how-can-i-reset-the-styles-given-to-series-in-highcharts – Aximili 2016-10-13 03:27:08