0

我正在尝试布局 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
4

1 回答 1

0

有两种简单的方法可以做到:

  1. 使用maxLabelSizelabelFunc。前者是以像素为单位的最大标签大小。后者是一个函数,它接受一个数字,并返回一个对应的字符串标签。
  2. 使用labels,它是一个{value, text}对象数组,并在末尾包含一个具有所需大小的长虚拟字符串和一些虚假值。

我不记得没有自定义标签怎么做,所以如果你觉得真的需要它,请提交增强票

于 2010-06-23T23:54:47.610 回答