Javascript highcharts工具提示格式化程序仅显示this.point.name中的前8个字符

Javascript highcharts工具提示格式化程序仅显示this.point.name中的前8个字符,javascript,highcharts,tooltip,formatter,Javascript,Highcharts,Tooltip,Formatter,我找了一整天,找不到这个问题的答案。我是一个新手,但这似乎并不难做到 这是我在脚本中的内容: tooltip: { formatter: function() { return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %'; } }, 工具提示:{ 格式化程序:函数(){ 返

我找了一整天,找不到这个问题的答案。我是一个新手,但这似乎并不难做到

这是我在脚本中的内容:

 tooltip: {
    formatter: function() {
     return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
                        }
                    },
工具提示:{
格式化程序:函数(){
返回“+this.point.name+”:“+Math.round(this.percentage)+%”;
}
},
我只想显示this.point.name中的前8个字符


请帮忙

您应该能够在此函数中使用标准javascript,例如substring()

工具提示:{
格式化程序:函数(){
返回'+this.point.name.substring(0,7)+':'+Math.round(this.percentage)+'%;
}
},
 tooltip: {
    formatter: function() {
         return '<b>'+ this.point.name.substring(0,7) +'</b>: '+ Math.round(this.percentage) +' %';
    }
},