我正在尝试布局 2 个链接图表,一个在另一个之上,类似于您在 Google 财经页面上看到的内容。
我可以很好地渲染两个图表,但是让 plotAreas 准确排列有点神秘。每个图表的 chart.plotArea.width 似乎取决于我的 Y 轴标签的宽度。因此,这 2 个图表的宽度不同,并且具有不同的值chart.getCoord().l.
现在,我正在使用手动计算的偏移量,但必须有更好的方法。
this.chart.render(); // top chart, getCoords().w=800
// manually set margins for lower chart to match
this.chartVol.margins.l = this.chart.offsets.l - 59 + 10;
this.chartVol.margins.r = this.chart.offsets.r - 31 + 10;
// render bottom chart
this.chartVol.render(); // bottom chart same width, getCoords().w=800