Highcharts Chart在范围选择器按钮上损坏按

时间:2018-01-16 03:01:17

标签: javascript highcharts highstock

看来,当通过范围选择器按钮更改数据分组时,图表不会删除旧的dataGroupings,因此图表会很快变得混乱。您可以看到问题here

有什么方法可以解决这个问题吗?

以下是生成图表的代码。

Highcharts.stockChart('container', {

    chart: {
        height: 300
    },

    rangeSelector: {
        allButtonsEnabled: true,
        buttons: [{
            type: 'month',
            count: 3,
            text: 'Day',
            dataGrouping: {
                forced: true,
                units: [['day', [1]]]
            }
        }, {
            type: 'year',
            count: 1,
            text: 'Week',
            dataGrouping: {
                forced: true,
                units: [['week', [1]]]
            }
        }, {
            type: 'all',
            text: 'Month',
            dataGrouping: {
                forced: true,
                units: [['month', [1]]]
            }
        }],
        buttonTheme: {
            width: 60
        },
        selected: 2
    },

    title: {
        text: 'AAPL Stock Price'
    },

    subtitle: {
        text: 'Custom data grouping tied to range selector'
    },

    _navigator: {
        enabled: false
    },

    series: [{
        name: 'AAPL',
        data: data,
        marker: {
            enabled: null, // auto
            radius: 3,
            lineWidth: 1,
            lineColor: '#FFFFFF'
        },
        tooltip: {
            valueDecimals: 2
        }
    }]
});

0 个答案:

没有答案
相关问题