Highcharts多个yaxis plotband碰撞

时间:2016-05-02 16:28:33

标签: javascript highcharts

我一直在尝试使用多个y轴的角度规。我使用了偏移轴属性来避免它们之间的冲突。但是,轴的绘图带相互碰撞。是否有任何财产可以将它们分开或任何其他解决方法?

我的尝试:

$(function () {

    $('#container').highcharts({

        chart: {
            type: 'gauge',
            plotBackgroundColor: null,
            plotBackgroundImage: null,
            plotBorderWidth: 0,
            plotShadow: false
        },

        title: {
            text: 'Speedometer'
        },

        pane: {
            startAngle: -90,
            endAngle: 90,
            background: null
        },

        // the value axis
        yAxis:[
        {
            min: 0,
            max:100,

            minorTickInterval: 'auto',
            minorTickWidth: 1,
            minorTickLength: 10,
            minorTickPosition: 'inside',
            minorTickColor: '#666',
                  labels: {
                distance: 12,
                rotation: 'auto'
            },
            offset: -30,
            tickPixelInterval: 30,
            tickWidth: 2,
            tickPosition: 'inside',
            tickLength: 10,
            tickColor: '#666',
            labels: {
                step: 2,
                rotation: 'auto'
            },

             plotBands: [{
                from: 0,
                to: 10,
                color: '#55BF3B',
            }, {
                from: 10,
                to: 70,
                color: '#DDDF0D',
            }, {
                from: 70,
                to: 90,
                color: '#DF5353',  
            }]


        },
         {
            min: 0,
            max:100,

            minorTickInterval: 'auto',
            minorTickWidth: 1,
            minorTickLength: 10,
            minorTickPosition: 'inside',
            minorTickColor: '#666',
                  labels: {
                distance: 12,
                rotation: 'auto'
            },
            offset: 30,
            tickPixelInterval: 30,
            tickWidth: 2,
            tickPosition: 'inside',
            tickLength: 10,
            tickColor: '#666',
            labels: {
                step: 2,
                rotation: 'auto'
            },

             plotBands: [{
                from: 0,
                to: 10,
                color: 'red',
                offset:30,// green
            }, {
                from: 10,
                to: 70,
                color: 'orange' // yellow
            }, {
                from: 70,
                to: 90,
                color: 'violet' // red
            }]


        }

        ],

        series: [{
            name: 'Speed',
             data: [{
                id: 'hour',
                y: 90,
            }],
        },{
        name: 'Speed',
             data: [{
                id: 'minute',
                y: 50,
            }],
        },
        ]

    },



    // Add some life
    function (chart) {
        if (!chart.renderer.forExport) {
            setInterval(function () {

            }, 3000);
        }
    });

        $('.highcharts-axis text').click(function(){                                      alert($(this).text());  
        }); 
});

https://jsfiddle.net/n1djkxLr/8/

1 个答案:

答案 0 :(得分:1)

此问题与我们的开发人员在此处报告的已知错误有关:https://github.com/highcharts/highcharts/issues/5283