Fixed y-axis label width in Highcharts

后端 未结 3 1684
心在旅途
心在旅途 2021-02-19 00:05

I\'m building a data presentation where two Highcharts charts are stacked vertically and are intended to share the same x-axis units and alignment. Like so:

相关标签:
3条回答
  • 2021-02-19 00:36

    If you set the chart.marginLeft option, it will override the auto size labels so the Y axes become aligned.

    0 讨论(0)
  • 2021-02-19 00:42

    This is a late answer, but you can now do multiple charts inside the same Highcharts object. You wouldn't have to manually try to force the Y axes to align when using this method, as Highcharts would do all the work for you.

    http://www.highcharts.com/demo/combo

    0 讨论(0)
  • 2021-02-19 00:46

    A little hacky way, but should work:

    • set for both xAxis width, e.g. 400px
    • set for all axis (xAxis and yAxis) right, e.g. 20px

    Now yAxis should have the same width and also the same extremes etc.

    Another (and maybe even better) solution is to use two panes for Highcharts. It works exactly the same way as in Highstock, see example: http://www.highcharts.com/stock/demo/candlestick-and-volume

    0 讨论(0)
提交回复
热议问题