gpt4 book ai didi

javascript - 将自定义数据添加到 High Charts 数据导出

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

我有一个带有工具提示的饼图,显示了一些额外的数据。如何让这些数据与数据表一起导出?

当您单击“导出”>“查看数据表”时,我需要将 {point.custom} 添加为列

JSFiddle 链接:https://jsfiddle.net/mewohraz/1/

Highcharts.chart('container', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: 'Browser market shares in January, 2018'
},
tooltip: {
pointFormat: '{point.custom}'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
name: 'Brands',
colorByPoint: true,
data: [{
name: 'Chrome',
y: 61.41,
custom: 200,
sliced: true,
selected: true
}, {
name: 'Internet Explorer',
y: 11.84,
custom: 100
}, {
name: 'Firefox',
y: 10.85,
custom: 300
}]
}]
});

最佳答案

您可以通过keys属性添加自定义数据:

keys: ['x', 'y', 'custom']

现场演示:https://jsfiddle.net/BlackLabel/3m82ck5w/

API引用:https://api.highcharts.com/highcharts/series.pie.keys

关于javascript - 将自定义数据添加到 High Charts 数据导出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54832539/

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