首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >highcharts股票图表1m和3m未启用

highcharts股票图表1m和3m未启用
EN

Stack Overflow用户
提问于 2014-12-29 19:19:50
回答 1查看 511关注 0票数 0

请参考http://jsfiddle.net/a6h6cLnt/。“3M”和“1M”按钮不工作。早些时候,对于较小的数据集,所有缩放按钮都不起作用。较小数据集的url为http://jsfiddle.net/a6h6cLnt/1/

代码语言:javascript
复制
$(function () {
    var seriesOptions = [],
        seriesCounter = 0,
        names = ['MSFT'],
        // create the chart when all data is loaded
        createChart = function () {

            $('#container').highcharts('StockChart', {

                rangeSelector: {
                    selected: 4
                },

                yAxis: {
                    labels: {
                        formatter: function () {
                            return (this.value > 0 ? ' + ' : '') + this.value + '%';
                        }
                    },
                    plotLines: [{
                        value: 0,
                        width: 2,
                        color: 'silver'
                    }]
                },

                plotOptions: {
                    series: {
                        compare: 'percent'
                    }
                },

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

                series: seriesOptions
            });
        };

    $.each(names, function (i, name) {

        $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=' + name.toLowerCase() + '-c.json&callback=?',    function (data) {

            seriesOptions[i] = {
                name: name,
                data: [[1346371200000,12],[1348963200000,13],[1354233600000,4],[1377907200000,12],[1380499200000,13],[1385769600000,4],[1406764800000,1],[1409443200000,15],[1412035200000,20],[1414713600000,2],[1417305600000,4]]
            };

            // As we're loading the data asynchronously, we don't know what order it will arrive. So
            // we keep a counter and create the chart when all the data is loaded.
            seriesCounter += 1;

            if (seriesCounter === names.length) {
                createChart();
            }
        });
    });
});
<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>


<div id="container" style="height: 400px; min-width: 310px"></div>

“1M”和“3M”缩放按钮/链接不起作用。请让我知道如何启用它们或使它们工作

关于约瑟夫

EN

回答 1

Stack Overflow用户

发布于 2014-12-29 20:47:38

您需要设置minRange参数来定义最小缩放。

示例:http://jsfiddle.net/a6h6cLnt/2/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27687845

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档