Jquery Highcharts饼图,将系列中的第一项切分
我在饼图中有一系列数据,从最高值到最低值排序。我想让饼图切掉第一个最大的值。我尝试了多种方法,但都没有成功。我的饼图代码如下 如何通过初始化饼图来实现这一点Jquery Highcharts饼图,将系列中的第一项切分,jquery,highcharts,Jquery,Highcharts,我在饼图中有一系列数据,从最高值到最低值排序。我想让饼图切掉第一个最大的值。我尝试了多种方法,但都没有成功。我的饼图代码如下 如何通过初始化饼图来实现这一点 $(divID).highcharts({ credits: false, chart: { plotBackgroundColor: null, plotBorderWidth: null,
$(divID).highcharts({
credits: false,
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: chartData.title
},
subtitle: {
text: chartData.subtitle
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
formatter: function () {
return Highcharts.numberFormat(Math.round(this.percentage * 100) / 100, 1) + '%';
},
distance: -30,
color: 'black'
},
showInLegend: true
}
},
noData: {
enabled: true
},
series: [{
colorByPoint: true,
data: chartData.seriesData[0]
}]
});
我在初始化之后尝试了这个方法,但最后一个片段仍然被选中
$(divID).highcharts.series[0].data[0].slice();
Highcharts不会对系列进行排序,您可以获取最大值,然后选择最大值的数据
var chart = $(divID).highcharts;
var max = Math.max.apply(Math, chart.series[0].data.map(function(v){
return v.y;
}));
var maxData = chart.series[0].data.filter(function(v){
if (v.y == max)
{
return v.y;
}
})[0]
这里有一个提琴,它使用股票饼图选择具有最高值的数据您可以对加载事件的第一个点进行切片-请参阅 例如:
chart: {
type: 'pie',
events: {
load: function () {
this.series[0].data[0].slice();
}
}
},