在格式化程序中格式化Highcharts图表工具提示pointFormat

时间:2016-03-24 11:40:26

标签: highcharts

如何在tooltip格式化程序中显示series.name?目前它只显示{series.name}。

 tooltip: {
            formatter: function () {
                return '<b>{series.name}: ' +    Highcharts.numberFormat(this.y, 2) + '</b>';

                }
            },

编辑:

new tooltip has been initially created in c# 
tooltip = new { pointFormat = "<span style=\"color:   {series.color}\">\u25CF</span> {series.name}: <b>{point.y:,.1f}</b><br/>" };

...我可以将this.y值重写为2位小数,但是通过显示series.name

而卡住了

1 个答案:

答案 0 :(得分:4)

tooltip: {
        formatter: function () {
            return '<b>' + this.series.name + ': '+ Highcharts.numberFormat(this.y, 2) + '</b>';
            }
        }