简体   繁体   English

高库存/高图表在单个工具提示中显示多个y轴值

[英]Highstock/highcharts show multiple y-axis values in single tooltip

I have a highstock chart with two y-axes. 我有一个带有两个Y轴的高位图表。 When I mouseover the chart, the default tooltip only shows one of the y-axis, unless I directly put my mouse over the excluded series' point. 当我将鼠标悬停在图表上时,默认的工具提示仅显示y轴之一,除非我直接将鼠标悬停在排除的序列的点上。 Is there a way to just show both y-axes in the tooltip at whatever x value the mouse is over in the chart? 有没有一种方法可以在工具提示中仅在图表上将鼠标悬停在x上的位置显示两个y轴?

I guess that you need something which map points between axis. 我想您需要在轴之间映射点的东西。 Its not built-in, but you can use formatter and prepare something like this: 它不是内置的,但是您可以使用格式化程序并准备如下内容:

formatter: function(){
            var y = this.y,
                txt = 'y1: ' + y,
                yAxis = this.series.yAxis,
                index = this.series.yAxis.options.index == 0 ? 1 : 0,
                oAxis = this.series.chart.yAxis[index];

            txt += '<br>y2: ' + oAxis.toValue(yAxis.toPixels(y));

            return txt;
 }

http://jsfiddle.net/bu7ryzfL/ http://jsfiddle.net/bu7ryzfL/

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

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