Javascript 高价股中图表的不规则显示

Javascript 高价股中图表的不规则显示,javascript,jquery,highstock,Javascript,Jquery,Highstock,我真的无法理解这一点,有人已经建议我,在处理多个更新时,我应该将最后一个更新的动画设置为false。但我不知道我该怎么做。或者,这仅适用于使用addPoints时。这是我的代码和示例代码 $(function () { $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function (data) { $('.zoom_con

我真的无法理解这一点,有人已经建议我,在处理多个更新时,我应该将最后一个更新的动画设置为false。但我不知道我该怎么做。或者,这仅适用于使用addPoints时。这是我的代码和示例代码

$(function () {
    $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function (data) {
        $('.zoom_controls a').click(function (e) {
            e.preventDefault();
            // OK, pretty ugly :)
            var call = 'zoom' + $(this).attr('data-range');
            // I have two globally accessible charts here:
            if ($(this).attr('data-chart') == 'line') {
                lineChart[call]();
            } else {
                candleChart[call]();
            }
            $(this).addClass('active');

        });
        var proto = Highcharts.Chart.prototype;
        proto.zoomToD = function (delta) {
            var chartMin = this.xAxis[1].min;
            var chartMax = this.xAxis[0].max;
            var min = chartMax - delta;

            if (chartMin < min) {
                // this.xAxis[0] is the view, this.xAxis[1] is the navigator
                this.xAxis[0].setExtremes(min, chartMax);
                this.yAxis[0].setExtremes(this.series[0].dataMin, this.series[0].dataMax);
                return true;
            }

            this.xAxis[0].setExtremes(chartMin, chartMax);
            this.yAxis[0].setExtremes(this.series[0].dataMin, this.series[0].dataMax);
            return false;
        };

        proto.zoom3m = function () {
            return this.zoomToD(2592000 * 3 * 1000);
        };
        proto.zoom6m = function () {
            return this.zoomToD(2592000 * 6 * 1000);
        };
        proto.zoom1y = function () {
            return this.zoomToD(2592000 * 12 * 1000);
        };
        proto.zoom2y = function () {
            return this.zoomToD(2592000 * 24 * 1000);
        };
        proto.zoom3y = function () {
            return this.zoomToD(2592000 * 36 * 1000);
        };
        proto.zoom5y = function () {
            return this.zoomToD(2592000 * 60 * 1000);
        };
        proto.zoom10y = function () {
            return this.zoomToD(2592000 * 120 * 1000);
        };
        proto.zoomYtd = function () {
            var chartMin = this.xAxis[1].min;
            var chartMax = this.xAxis[1].max;
            var min = chartMax - 2592000 * 12 * 1000;

            if (chartMin < min) {
                this.xAxis[0].setExtremes(min, chartMax);
                return true;
            }

            this.xAxis[0].setExtremes(chartMin, chartMax);
            return false;
        }

        /*And then I define some stuff that instantiates Highcharts.StockChart objects, e.g.:*/
        var timestampTo = data[data.length - 1][0],
            timestampFrom = timestampTo - 365 * 24 * 3600 * 1000;
        lineChart = new Highcharts.StockChart({
            chart: {
                renderTo: 'container',
                type: 'area'


            },

            series: [{
                id: "data",
                name: 'HP',
                data: data,
                color: '#7BA6A5',
            }],
            tooltip: {
                shared: true,
                useHTML: true,
                headerFormat: '<table>',
                pointFormat: '<tr>' +
                    '<td style=\"color: #9c9e9c\"><b>日期:</b><span style="font-weight:bold;color:#7BA6A5">&nbsp;{point.x:%Y/%m/%d}</span></td></tr>' +
                    '<tr><td style=\"color: #9c9e9c\"><b>NAV 淨值:</b><span style="font-weight:bold;color:#7BA6A5">&nbsp;{point.y}</span></td></tr>',
                footerFormat: '</table>',
                valueDecimals: 2
            },
            xAxis: {
                min: timestampFrom,
                max: timestampTo,
                type: 'datetime',
                dateTimeLabelFormats: {
                    year: '%Y',
                    month: '%m',
                    week: '%b %e'
                },
                gridLineWidth: 1

            },

            yAxis: {
                opposite: false,
                minorTickInterval: 'auto'
            },
            rangeSelector: {
                enabled: true,
                inputPosition: {
                    align: "left"
                }

            },
            scrollbar: {
                enabled: true
            },
            navigator: {
                enabled: true
            }
        });
        lineChart.yAxis[0].setExtremes(lineChart.series[0].dataMin, lineChart.series[0].dataMax);
        lineChart.scroller.xAxis.labelGroup.hide();
        lineChart.scroller.xAxis.gridGroup.hide();
        lineChart.scroller.series.hide();
        lineChart.scroller.scrollbar.hide();
        lineChart.scroller.scrollbarGroup.hide();
        lineChart.scroller.navigatorGroup.hide();
        lineChart.scroller.scrollbarTrack.hide();
        $.each(lineChart.scroller.elementsToDestroy, function (i, elem) {
            elem.hide();
        });
        lineChart.rangeSelector.zoomText.hide();
        $.each(lineChart.rangeSelector.buttons, function () {
            this.hide();
        });
        /*lineChart.rangeSelector.inputEnabled = false;*/

    });
});

我忘了提到,只有再次单击YTD按钮时才会出现这种情况。

我也为我的YTD添加了一个设置极端值。我不确定这样做是否正确,但它可以防止图形显示数据异常。更新。

到底出了什么问题。。?年初至今仍存在射程问题?对于极端情况,你仍然有不同的时间范围。。看:是的,我想我明白了,我想让我把我的答案贴出来