gpt4 book ai didi

highcharts - 自定义 Highcharts 饼图选择状态,以便切片在选择时不会动画化

转载 作者:行者123 更新时间:2023-12-03 18:08:24 25 4
gpt4 key购买 nike

我正在尝试自定义 Highcharts 饼图切片的选择状态,以便它在被选中时不会移出。 HighCharts selection state documentation为选择状态提供“半径”选项,但这些设置对饼图没有影响:

$(function () {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'pie'
},
plotOptions: {
series: {
allowPointSelect: true,
marker: {
states: {
select: {
radius: 0,
fillColor: '#666'
}
}
}
}
},

series: [{
data: [['Jan', 29.9], ['Feb', 71.5], ['Mar', 106.4], ['Apr', 129.2], ['May', 144.0], ['Jun', 176.0], ['Jul', 135.6], ['Aug', 148.5], ['Sep', 216.4], ['Oct', 194.1], ['Nov', 95.6], ['Dec', 54.4]]
}]
});
});​

参见 Working Example .

以下示例说明如何更改选定切片的颜色,但这些设置是 not documented添加“半径”属性无效:

$(function () {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'pie'
},
plotOptions: {
series: {
allowPointSelect: true,
states: {
select: {
color: '#666'
}
}
}
},

series: [{
data: [['Jan', 29.9], ['Feb', 71.5], ['Mar', 106.4], ['Apr', 129.2], ['May', 144.0], ['Jun', 176.0], ['Jul', 135.6], ['Aug', 148.5], ['Sep', 216.4], ['Oct', 194.1], ['Nov', 95.6], ['Dec', 54.4]]
}]
});
});​

参见 working example

有没有人设法禁用饼图切片选择动画,而只对所选切片应用填充颜色?

最佳答案

感谢 Sebastian 和 Pawel 在 Highcharts Support Forum 上的帮助通过“slicedOffset:0”设置禁用切片动画:

$(function () {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'pie'
},
plotOptions: {
series: {
allowPointSelect: true,
slicedOffset: 0,
states: {
select: {
color: '#666'
}
}
}
},

series: [{
data: [['Jan', 29.9], ['Feb', 71.5], ['Mar', 106.4], ['Apr', 129.2], ['May', 144.0], ['Jun', 176.0], ['Jul', 135.6], ['Aug', 148.5], ['Sep', 216.4], ['Oct', 194.1], ['Nov', 95.6], ['Dec', 54.4]]
}]
});
});​

参见 working example

关于highcharts - 自定义 Highcharts 饼图选择状态,以便切片在选择时不会动画化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13608225/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com