简体   繁体   English

渲染图表后如何更改工具提示值后缀?

[英]How to change tooltip valueSuffix after chart is rendered?

I'm wondering is there any way to change valueSuffix of tooltip after chart is rendered? 我想知道有什么方法可以在呈现图表后更改工具提示的valueSuffix吗?

I'm trying to do switch from metric units to imperial, so I need to change data, yAxis label and tooltip valueSuffix. 我正在尝试从公制转换为英制,因此我需要更改数据,yAxis标签和工具提示valueSuffix。 It was simple for first two, but I didn't find anything about third, neither in docs (like yAxis update(..)), neither in google. 前两个很简单,但是我没有找到关于第三个的任何东西,既没有在文档中找到(例如yAxis update(..)),也没有在google中找到。

Tried this: 试过这个:

$('#sp_chart').highcharts().tooltip.options.valueSuffix = 'aaaa';

in

console.log($('#sp_chart').highcharts().tooltip.options.valueSuffix) 

it looks good, but didn't works when tooltip shows. 它看起来不错,但在工具提示显示时却不起作用。

You can define a suffix in the series object, and use series update to modify this parameter. 您可以在系列对象中定义后缀,并使用系列更新来修改此参数。

series: [{
        tooltip:{
            valueSuffix: ' USD',
        },
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
    }]
/*...*/
    chart.series[0].update({
                tooltip:{
                valueSuffix: ' EUR',
            },
    });

Example: http://jsfiddle.net/Ujw8B/ 示例: http//jsfiddle.net/Ujw8B/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM