如何在给定代码的高图中使用范围选择器和导航

问题描述 投票:0回答:1
$(document).ready(function () {
    var options = {
        chart: {renderTo: 'container', type: 'line',}, rangeSelector: {enabled: true}, series: [{}]
    };
    $.getJSON('chart.php', function (data) {
        options.series[0].data = data
        var chart = new Highcharts.chart(options);

    });
});
javascript highcharts
1个回答
0
投票

范围选择器和导航器是Highstock功能。要使用它们,请使用Highstock源代码和stockChart构造函数类型。

$(document).ready(function() {
    var options = {
        chart: {
            renderTo: 'container',
            type: 'line',
        },
        rangeSelector: {
            enabled: true
        },
        series: [{}]
    };

    $.getJSON('chart.php', function(data) {
        options.series[0].data = data
        var chart = new Highcharts.stockChart(options);
    });
});

实时演示: http://jsfiddle.net/BlackLabel/n49t268u/

文档: https://www.highcharts.com/docs/stock/understanding-highstock

© www.soinside.com 2019 - 2024. All rights reserved.