简体   繁体   English

将options.rangeSelector.selected设置为0不会将缩放比例设置为高库存中的正确水平

[英]Setting options.rangeSelector.selected to 0 does not set zoom to correct level in highstock

I am trying to change the default zoom level on a simple highstock chart. 我正在尝试在简单的highstock图表上更改默认的缩放级别。 I've been looking around for a solution and came up with this: 我一直在寻找解决方案,并提出了以下建议:

rangeSelector: {
            selected:0,
        },

This did not work with the code below 这不适用于下面的代码

   chart = new Highcharts.StockChart({
        chart: {
            renderTo: 'dummycontainer'
        },

        rangeSelector: {
            selected:0,
        },


        credits: {
            enabled: false
        },

        yAxis: {
            title: {
                text: ''
            },
            max: 100
        },

        tooltip: {
            pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> <br/>', //({point.change}%)
            valueDecimals: 2
        },
        series: [{
            name: 'MMP',
            data: [

            ],
            marker : {
                enabled : true,
                radius : 3
            },
            shadow : true
        }]
    });

What could be causing this? 是什么原因造成的?

rangeSelector: {
    selected:0
}

very much works 很多作品

Change default time range | 更改默认时间范围 Highchart & Highstock @ jsFiddle Highchart和Highstock @ jsFiddle

Check for any other javascript related errors in your browser's javascript console. 在浏览器的JavaScript控制台中检查其他与JavaScript相关的错误。 If you are trying out on IE or even otherwise I would recommend removing the trailing comman( , ) from selected:0, like in the code above or the demo. 如果您尝试使用IE甚至其他方法,则建议从selected:0,删除结尾的comman( ,selected:0,例如上面的代码或演示中的代码。

Trailing commas lead to invalid json and some browsers may not behave correctly with them. 尾随逗号会导致json无效,并且某些浏览器可能无法正确使用它们。 You can validate your json @ http://jsonlint.com/ or try the JSLint option in jsFiddle. 您可以验证json @ http://jsonlint.com/或尝试使用jsFiddle中的JSLint选项。

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

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