简体   繁体   中英

*Highcharts* Tooltip formatter for a combined chart

I have a combine percent column and line chart with two y axis. The column chart I use absolute value to draw and the line chart I use percent value, and I have a tooltip like this:

pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.percentage:.1f}%</b> ({point.y})<br/>',
shared: true

When I use this tooltip, it shows the correct format for my percent column chart: percent value (absolute value) but wrong format for line chart which shows something like: 0.0%( percent value). How can I format my tooltip so that it can show the percent value for the percent column chart like its showing but in the line chart it shows only the value at this point which is already a percent value.

My jsfiddle: http://jsfiddle.net/3d406av3/2/

You can set tooltip.pointFormat on a series level: http://jsfiddle.net/3d406av3/3/

For example:

{
    type:'line',
    name: 'Suzo',
    tooltip: {
        pointFormat: '<span style="color:{series.color}">{series.name}: </span>{point.y}<br/>',
    },
    yAxis:1,
    data: [123, 11, 14, 66, 44]
}

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