Highcharts多面板和滚动条

时间:2019-01-31 18:54:03

标签: highcharts

如何添加具有多窗格的滚动条?

请查看小提琴,第三个窗格重叠

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
  }]

注意:在我的情况下,它可以是100个多窗格。

enter image description here

1 个答案:

答案 0 :(得分:0)

y轴的高度之和大于100%,这会导致重叠。您不应超过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
        }]

实时演示:http://jsfiddle.net/BlackLabel/g7uto6xc/

API参考:https://api.highcharts.com/highstock/yAxis.height

编辑:

经过大量自定义后,达到了想要的结果:

实时演示:http://jsfiddle.net/BlackLabel/u293pvnj/