简体   繁体   English

在同一张图上堆叠高图,每次都有新的y轴?

[英]Stacked highcharts on the same graph, with a new y axis each time?

I'm not sure if this is possible, but I have separate, stacked highcharts. 我不确定是否可行,但是我有单独的,堆叠的图表。 I'd like to keep them on the same graph, but stacked on top of each other, resetting the y axis to 0 each time. 我想将它们保留在同一张图上,但彼此堆叠,每次将y轴重置为0。 Here is a Fiddle of them all separate: 这是它们各自独立的小提琴

I've also attached an example graph of what I am imagining. 我还附上了一个我想象中的示例图。 The blue horizontal lines represent each new chart series's 0 point. 蓝色水平线代表每个新图表系列的0点。

Sample graph example 样本图示例

//random line so it will let me post the fiddle. Ignore this

You are making highchart for each series in the array seriesAll by looping through it and that is causing it to create seperate charts for each series. 您正在循环遍历数组seriesAll ,从而为每个系列绘制高图,这将导致它为每个系列创建单独的图表。 If you just create 1 highchart and give it the series array, it will plot all the series on the same chart. 如果仅创建1个图表,并为其提供序列数组,它将在同一图表上绘制所有序列。 Here is a modified version of your code to give you what your looking for. 这是代码的修改版本,可为您提供所需的内容。

https://codepen.io/Nasir_T/pen/zdzdrW https://codepen.io/Nasir_T/pen/zdzdrW

Also please check out the docs of highcharts and it will give you all the information you need. 另外,请查阅highcharts的文档,它会为您提供所需的所有信息。 Eg here is the combined charts link: 例如,这是组合图表链接:

https://www.highcharts.com/docs/chart-and-series-types/combining-chart-types https://www.highcharts.com/docs/chart-and-series-types/combining-chart-types

[Edit for stacking option] [编辑堆叠选项]

You can also stack them on top of each other by setting the plotOption > series > stacking properties. 您还可以通过设置plotOption> series> stacking属性将它们堆叠在一起。 eg 例如

plotOptions: {
    series: {
        stacking: 'normal'
    }
}

Learn more on stacking in the following doc link. 在以下文档链接中了解有关堆叠的更多信息。

http://api.highcharts.com/highcharts/plotOptions.area.stacking http://api.highcharts.com/highcharts/plotOptions.area.stacking

Hope this helps. 希望这可以帮助。

You can also achieve a similar effect using different height of multiple yAxis. 您也可以使用多个yAxis的不同height来实现类似的效果。

Example: 例:
http://jsfiddle.net/6b9prwjc/ http://jsfiddle.net/6b9prwjc/

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

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