简体   繁体   English

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

[英]Highstock is only showing series when user zooms in

I'm coming accross an unusual problem with highcharts. 我遇到了一个高图异常问题。 I'm using stockcharts to render a chart with multiple series. 我正在使用图表绘制具有多个系列的图表。 Each series has a lot of points 100 or more. 每个系列的得分都在100以上。 This is the code that generates the chart. 这是生成图表的代码。

$('#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
});

This is the graph that I'm getting. 这是我得到的图。 Notice that only 1 series is graphed and the other series are not graphed. 请注意,仅绘制了一个系列,而未绘制其他系列。 I have been trying to do something like this http://www.highcharts.com/stock/demo/compare Could it be because there are to many points on the graph? 我一直在尝试做这样的事情http://www.highcharts.com/stock/demo/compare可能是因为图表上有很多点吗? I tried doing dataGrouping but that didn't work. 我尝试进行dataGrouping,但这没有用。

Any ideas what might be causing this? 任何想法可能是什么原因造成的?

Here is a JSFiddle replicating the problem 这是一个JSFiddle复制问题

http://jsfiddle.net/4kz7r/ http://jsfiddle.net/4kz7r/

Ok i figured it out. 好吧,我想通了。 I had to set the groupingWidthPixels higher. 我不得不将groupingWidthPixels设置得更高。 Here is the fiddle fix. 这是小提琴修复程序。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM