当一个图表具有多个 yAxis 时,在两个图表之间同步 xAxis 的宽度



我在一页上有两个高图表,其中一个图表可以动态添加和删除第二个或第三个 yAxis。当然,当这样做时,x轴的宽度比只有一个yAxis的宽度短。现在我想同步 xAxis 的宽度,以使两个图表彼此下方。当我尝试设置xAxis宽度时,宽度发生了变化,但图表区域粘在左侧而不是右侧。如何绘制具有相同尺寸的两个图表区域?

这是一个带有一个小例子的小提琴:Fiddle小提琴

最好 光先生

您可以使用 topwidthoffset 属性来调整和定位轴。其中前两个没有记录,但它们有效。

现场演示:http://jsfiddle.net/BlackLabel/cvey8ap8/

xAxis: {
      categories: ['Jane', 'John', 'Joe', 'Jack', 'jim'],
      width: '90%',
      left: '8%',
    // Categories for the charts
    },
    yAxis: [{
        min: 0, // Lowest value to show on the yAxis
        title: {
          text: 'Apple Consumption' // Title for the yAxis
        },
        left: '7%',
        offset: 0
      },
      {
        min: 0, // Lowest value to show on the yAxis
        title: {
          text: 'Apple12 Consumption' // Title for the yAxis
        },
        offset: 0
      }
    ],

最新更新