Highstock仅在用户放大时显示系列

时间:2014-02-15 22:46:45

标签: javascript highcharts highstock

我正在遇到一个与highcharts不同寻常的问题。我正在使用股票图表来呈现包含多个系列的图表。每个系列都有很多积分100或者更多。这是生成图表的代码。

$('#chart').highcharts('StockChart', {
    chart: {
        zoomType: 'x',
        alignTicks: false,
        backgroundColor: 'rgba(255, 255, 255, 0.1)'
    },
    title: {
        text: 'Google SERP Chart'
    },
    credits: {
        enabled: false
    },
    rangeSelector: {
        buttons: [{
            type: 'hour',
            count: 1,
            text: '1h'
        }, {
            type: 'day',
            count: 1,
            text: '1d'
        }, {
            type: 'month',
            count: 1,
            text: '1m'
        }, {
            type: 'year',
            count: 1,
            text: '1y'
        }, {
            type: 'all',
            text: 'All'
        }],
        inputEnabled: false, // it supports only days
        selected: 4 // all
    },

    xAxis: {
        type: 'datetime',
        title: {
            text: null
        },
        lineWidth: 2,
        minRange: 3600 * 1000,
        labels: {
            formatter: function () {
                return Highcharts.dateFormat('%a %d %b', this.value);
            }
        }
    },
    yAxis: {
        tickInterval: 1,
        title: {
            text: 'Ranking Position'
        }

    },
    series: series
});

这是我得到的图表。请注意,只绘制了1个系列,而没有绘制其他系列。 我一直试图做这样的事情 http://www.highcharts.com/stock/demo/compare 可能是因为图表上有很多点? 我尝试过dataGrouping,但是没有用。

任何可能导致此问题的想法?

这是一个JSFiddle复制问题

http://jsfiddle.net/4kz7r/

1 个答案:

答案 0 :(得分:0)

好的,我想通了。我不得不将groupingWidthPixels设置得更高。 这是小提琴修复。

series: {
    dataGrouping: {
        groupPixelWidth: 50
    }
}
}

http://jsfiddle.net/rHC8h/ :)