109*_*793 6 javascript jqplot pie-chart
我有一个使用JqPlot显示的饼图.我有兴趣改变切片的实际颜色,到目前为止还没有运气.
我遇到了这个链接并尝试了解决方案,但我不确定我是否将它放在错误的位置(尝试将其插入代码中的几个位置)就像我将它放入时一样,饼图没有更长的显示(实际上停止显示页面上的其余图表).
这是饼图的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'}
}
);
});
Run Code Online (Sandbox Code Playgroud)
有没有人有任何想法?
Nei*_*eil 17
您可以申请seriesColors一个options对象,例如:
options =
{
seriesColors: [ "#4bb2c5", "#c5b47f", "#EAA228", "#579575" ]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11527 次 |
| 最近记录: |