我有一个饼图显示使用JqPlot。我会有兴趣改变切片的实际颜色,迄今为止还没有运气。JqPlot饼图 - 更改饼切片颜色
我遇到了this link并尝试了解决方案,但我不确定是否将它放在错误的位置(试图在代码中的几个位置插入它),因为当我有它时,饼图不再显示(实际上停止显示页面上的其他图表)。
下面是饼图的JavaScript代码:
$(document).ready(function() {
var data = [['US',33], ['IE',30], ['GB',23], ['AU',7], ['CA',4], ['RoW',7]];
var plot1 = jQuery.jqplot('Countries', [data],
{
seriesDefaults: {
// Make this a pie chart.
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
// Put data labels on the pie slices.
// By default, labels show the percentage of the slice.
sliceMargin: 5,
showDataLabels: true,
}
},
legend: { show: true, border: false, /*placement: 'outsideGrid', location: 'w'*/location: 'e', border: 'none' },
grid: {borderWidth:0, shadow:false, background: '#FFFFFF'}
}
);
});
有没有人有什么想法?
看看seriesColors - http://www.jqplot.com/docs/ files/jqPlotOptions-txt.html – Neil
@Neil完美的工作。你想把你的链接作为答案,我会把它标记为正确的? – 109221793