工具提示中的高图表总计

2024-01-03

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

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/ 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
},
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

工具提示中的高图表总计 的相关文章

随机推荐