简体   繁体   English

Highcharts 在鼠标悬停在图表线上时显示/突出显示 y 轴

[英]Highcharts show / highlight y-Axis on mouseover over chart line

I have a complex chart with many y-Axis (>8) which results in not the best ux.我有一个带有许多 y 轴 (>8) 的复杂图表,这导致不是最好的 ux。 Per y-Axis multiple graph lines may be plottet.每个 y 轴可以绘制多条图形线。

I think the following may improve this.我认为以下可能会改善这一点。

  • up to eg for y-Axis on mouseover graph line highlight the corresponding y-Axis.高达例如鼠标悬停图形线上的 y 轴突出显示相应的 y 轴。
  • for more than 4 y-Axis show only one y-Axis and on mouseover a graph line show the corresponding y-Axis.对于 4 个以上的 y 轴,仅显示一个 y 轴,鼠标悬停在一条曲线上时会显示相应的 y 轴。

Is there any setting or plugin available providing such or similar behavior which I oversaw?是否有任何设置或插件可提供我监督的此类或类似行为?

How can I get from a mouseover over a graph line the corresponding y-Axis?如何从鼠标悬停在图形线上获得相应的 y 轴? (And what's the proper way for a rendered graph to hide y-Axis and show another one?) (渲染图形隐藏 y 轴并显示另一个的正确方法是什么?)

Thx for sharing your expertise, I really appreciate.感谢分享您的专业知识,我真的很感激。

You can use mouseOver and mouseOut events to highlight or show/hide the corresponding y-Axis.您可以使用mouseOvermouseOut事件来突出显示或显示/隐藏相应的 y 轴。 For example:例如:

plotOptions: {
  series: {
    events: {
      mouseOver: function() {
        this.yAxis.update({
          labels: {
            style: {
              color: 'red'
            }
          }
        });
      },

      mouseOut: function() {
        this.yAxis.update({
          labels: {
            style: {
              color: '#666666'
            }
          }
        });
      }
    }
  }
}

Live demo: http://jsfiddle.net/BlackLabel/6m4e8x0y/4898/现场演示: http : //jsfiddle.net/BlackLabel/6m4e8x0y/4898/

API Reference: API参考:

https://api.highcharts.com/highcharts/plotOptions.series.events https://api.highcharts.com/highcharts/plotOptions.series.events

https://api.highcharts.com/class-reference/Highcharts.Axis#update https://api.highcharts.com/class-reference/Highcharts.Axis#update

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

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