Highcharts Multi-Panes and Scrollbar

2019-08-26 20:49发布

问题:

How to add a scroll with multi-panes?

Please look at the fiddle, 3rd pane is overlapping

yAxis: [{
    title: { text: 'Coffee Cups'},
    height: '60%',
    offset: 0,
    lineWidth: 2
  }, {
    title: { text: 'Hazelnut Cups' },
    top: '65%',
    height: '60%',
    offset: 0,
    lineWidth: 2
  }, {
    title: { text: 'Choco Cups' },
    top: '130%',
    height: '60%',
    offset: 0,
    lineWidth: 2
  }]

Note: In my scenario, it can be 100 multi panes.

回答1:

The sum of the heights of your y-axes is more than 100% which causes the overlapping. You should not exceed 100%:

        yAxis: [{
            labels: {
                align: 'right',
                x: -3
            },
            title: {
                text: 'Coffee Cups'
            },
            height: '33.33%',
            offset: 0,
            lineWidth: 2
        }, {
            labels: {
                align: 'right',
                x: -3
            },
            title: {
                text: 'Hazelnut Cups'
            },
            top: '33.33%',
            height: '33.33%',
            offset: 0,
            lineWidth: 2
        }, {
            title: {
                text: 'Hazelnut Cups'
            },
            top: '66.66%',
            height: '33.33%',
            offset: 0,
            lineWidth: 2
        }]

Live demo: http://jsfiddle.net/BlackLabel/g7uto6xc/

API Reference: https://api.highcharts.com/highstock/yAxis.height

EDIT:

After a lot of customizations, the wanted result was achieved:

Live demo: http://jsfiddle.net/BlackLabel/u293pvnj/



标签: highcharts