Compare two data points inside the tooltip in a Highcharts combination chart

China☆狼群 提交于 2019-12-24 00:59:32

问题


I have a combination bar-line chart sharing a single Y axis.

The data points for both the bar and the line chart always share the same Y values. I'd like to be able to calculate the difference between the two X values in the tooltip.

Here's the chart I'm working with:

Combo Chart


回答1:


Got it to work. The trick was in the shared and formatter properties of tooltip:

       tooltip: {

            shared: true,

            formatter: function() {


                var s= this.points[1].y - this.points[0].y;



                return s;

            }

        },


来源:https://stackoverflow.com/questions/10747277/compare-two-data-points-inside-the-tooltip-in-a-highcharts-combination-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!