简体   繁体   English

Highcharts中的第二个Y轴链接到特定数据系列

[英]Second Y-Axis in Highcharts linked to specific data series

i have 6 series (lines) within one chart categorized by date. 我在按日期分类的一张图表中有6个系列(线)。 one of the series has a way higher max point than all the others making them disappear into aa single line at the bottom. 该系列中的一个具有比所有其他系列更高的最大点,这使得它们消失在底部的一条直线上。 the data is generated from different reports with series in different order but mostly with the same data mixed together with variable data. 数据是由不同报表生成的,这些报表具有不同的顺序,但是大多数情况下,相同的数据与可变数据混合在一起。 i want to add a second y-axis on the right to keep that one single series separated from all the other data but i need a way to tell highcharts to take a specific series which name i know. 我想在右侧添加第二个y轴,以使一个序列与所有其他数据分开,但是我需要一种方法来告诉highcharts使用我知道的特定序列。 series.name would be always the same. series.name将始终相同。 is there any way to accomplish that? 有什么办法可以做到这一点?

thanks! 谢谢!

This is how you define "y" axes - 这就是您定义“ y”轴的方式-

yAxis: [{},{},{}] 
// so "yAxis" is just an array of y-axis-objects (i.e. yAxis[0], yAxis[1]...)

And you can tell Highcharts which one of these y axes you want your series be associated with as follows - 然后,您可以如下告诉Highcharts您想要将系列与这些y轴之一相关联-

series: [{yAxis: 1}, {yAxis: 2}, {}]

So, your first series will be associated with yAxis[1] , second with yAxis[2] and the third by default with yAxis[0] . 因此,您的第一个序列将与yAxis[1]关联,第二个与yAxis[2]关联,默认情况下,第三个与yAxis[0]

Check out the API ref on yAxis and series . 查看yAxisseries上的API参考。

You can also see the demo of dual-axes here . 您还可以在此处查看双轴的演示。 There you can click the "View Options" to see how the options object is configured. 您可以在此处单击“查看选项”以查看options对象的配置方式。

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

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