问题
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