数字格式在Highcharts图表值? [英] Number Formatting at Highcharts Chart Values?

查看:112
本文介绍了数字格式在Highcharts图表值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将这个值赋予Highcharts饼图:

 系列:[
{
type: 'pie',
name:'Ratio',
data:[
['A',42.6],
{
名称:'B',
y:14.2,
sliced:true,
selected:true
}
]
}
]



然而,它在饼图中显示了它:

  A  - > 75.00000000000001%
B-> 25%

您可以在Highcharts中设置工具提示的格式,以及图表值?

解决方案

我们的工具提示格式化程序选项显示的值是数字而不是百分比

http://api.highcharts.com/highstock#tooltip.formatter

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

this.point.y将会执行此操作现在你在这个地方有this.percentage)


I give that values to Highcharts pie chart:

  series:[
        {
            type:'pie',
            name:'Ratio',
            data:[
                ['A', 42.6],
                {
                    name:'B',
                    y:14.2,
                    sliced:true,
                    selected:true
                }
            ]
        }
    ]

However it shows it like that at pie chart:

A -> 75.00000000000001 %
B-> 25 %

You can format tooltips at Highcharts how about chart values?

解决方案

We do have tooltip formatter options to display the value as number instead of percentage

http://api.highcharts.com/highstock#tooltip.formatter

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

this.point.y will do the trick (now you have this.percentage in that place)

这篇关于数字格式在Highcharts图表值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆