Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/405.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 更新数据时图表收缩_Javascript_Highcharts - Fatal编程技术网

Javascript 更新数据时图表收缩

Javascript 更新数据时图表收缩,javascript,highcharts,Javascript,Highcharts,我使用highchart时有一种奇怪的行为。有一次,当更新某个点时,我的图表收缩,并且在开始和结束时都有一些空值。请参见下图中的差异 这种情况只会偶尔发生一次,控制台中没有错误日志 以下是我的图表的配置: container.highcharts({ chart: { animation: false, type: 'column', spacingRight: 0 },

我使用highchart时有一种奇怪的行为。有一次,当更新某个点时,我的图表收缩,并且在开始和结束时都有一些空值。请参见下图中的差异

这种情况只会偶尔发生一次,控制台中没有错误日志

以下是我的图表的配置:

    container.highcharts({
        chart: {
            animation: false,
            type: 'column',
            spacingRight: 0
        },
        noData: { 
            position: {x: 10, y: 10},
            style: { color: "white" }
        },
        legend: {
            enabled: false
        },
        tooltip: {
            animation: false
        },
        credits: {
            enabled: false
        },
        title: {
            text: ''
        }, 
        xAxis: {
            type: 'datetime',
            minorGridLineWidth: 0,
            minorTickLength: 0,
            maxPadding: 0,
            minTickInterval: 60000,
            showFirstLabel: false,
            showLastLabel: false
        },
        yAxis: {
            minRange: 10,
            floor: 0,
            gridLineColor: "#000000",
            gridZIndex: 7,
            title: {
                text: widgetModel.title
            }
        },
        plotOptions: {
            column: {
                pointInterval: 0,
                pointPadding: 0,
                borderWidth: 1,
                borderColor: '#000000',
                groupPadding: 0,
                grouping: false,
                shadow: false
            },
            series: {
                pointInterval: 0,
                stacking: 'normal',
                events : {
                    click : function() {
                        var seriesArray = this.chart.series;
                        for (var i = 0; i < seriesArray.length; i++) {
                            var series = seriesArray[i];
                            if (series.name != this.name) {
                                if (series.visible) {
                                    series.setVisible(false, false);
                                } else {
                                    series.setVisible(true, false);
                                }
                            }
                        }
                        self.chart.redraw();
                    }
                }

            }

        },
        series: []
    });

那么有人知道为什么图表会缩小吗?

你能提供演示链接吗?第一件事:pointInterval:0-那该怎么办?如果不使用pointInterval,请删除该选项。关于您的问题,它看起来像是一个问题-尝试将其设置为一分钟3600*1000。如果这没有帮助,那么需要演示。
    addPointToSerie: function (serie, date, value) {
        var pointId = serie.name + "_" + date.getTime().toString();
        var point = undefined;
        var points = serie.points || [];

        // Allow fast access of point.
        if (this.pointMap.hasOwnProperty(pointId)) {
            point = this.pointMap[pointId];
        }
        else {
            for (var j = 0; j < points.length; j++) {
                if (points[j].id === pointId) {
                    point = points[j];
                    this.pointMap[pointId] = point;
                }
            }
        }

        if (point != undefined) {
            // Optimize to update only point that have change
            if (point.y != value) {
                point.update(value, false);
            }
        } else {
            serie.addPoint({x:date, y:value, id:pointId}, false, false, false);
        }
    },
this.chart.redraw();