gpt4 book ai didi

tooltip - 工具提示中的 highchart total

转载 作者:行者123 更新时间:2023-12-04 16:29:24 24 4
gpt4 key购买 nike

我正在使用此代码显示共享工具提示:

tooltip: {
crosshairs: true,
shared: true,
headerFormat: 'KW {point.key}<table>',
pointFormat: '<tr><td style=\"color: {series.color}\">{series.name}: <b></td><td>{point.y} USD</b></td></tr>',
useHTML: true,
footerFormat: '</table>',
valueDecimals: 2
},

现在我想将所有 point.y 值添加为该点的总值。但是我如何循环每个系列的 point.y 来计算总值?

最佳答案

没错,参见示例:http://jsfiddle.net/65bpvudh/7/

tooltip: {
formatter: function() {
var s = '<b>'+ this.x +'</b>',
sum = 0;

$.each(this.points, function(i, point) {
s += '<br/>'+ point.series.name +': '+
point.y +'m';
sum += point.y;
});

s += '<br/>Sum: '+sum

return s;
},
shared: true
},

关于tooltip - 工具提示中的 highchart total,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14717353/

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