简体   繁体   中英

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?

I'm trying to do switch from metric units to imperial, so I need to change data, yAxis label and tooltip valueSuffix. It was simple for first two, but I didn't find anything about third, neither in docs (like yAxis update(..)), neither in 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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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