导航仪设置为全范围

时间:2015-07-06 20:45:16

标签: javascript angularjs highcharts highstock

如何设置导航器以仅显示少量数据。导航器设置为全范围但我想通过滚动导航器仅显示我想要看到的两个数据和其余数据。我在这里添加js小提琴:http://jsfiddle.net/9y91y3s9/

HTML:

<div ng-app="myapp">
    <div ng-controller="myctrl">
        <div class="row">
            <highchart id="chart1" config="mtv" class="span10"></highchart>
        </div>
    </div>
</div>

<h3><a href="https://github.com/pablojim/highcharts-ng">See Highcharts-ng on github</a></h3>     

JavaScript:(请参阅https://github.com/pablojim/highcharts-ng

var myapp = angular.module('myapp', ["highcharts-ng"]);

myapp.controller('myctrl', function($scope, $timeout) {
    $scope.mtv = {

        useHighStocks: true,
        options: {
            xAxis: {
                type: "datetime",
                plotLines: [],
            },
            title: {
                text: 'fssfgdf'
            },
            rangeSelector: {
                enabled: false
            },
            navigator: {
                enabled: false,
            },
            scrollbar: {
                enabled: true
            },
        },
        series: [{
            name: 'gddfdg',
            data: [
                [1435324350703, 1],
                [1435324365737, 1],
                [1435324395659, 1],
                [1435324410674, 1]
            ],
            marker: {
                enabled: true,
                radius: 3
            },
        }],
    }
});

1 个答案:

答案 0 :(得分:0)

设置xAxis.minxAxis.max,例如:

        xAxis: {
            min: 1435324395659,
            max: 1435324410674,
            type: "datetime",
            plotLines: [],
        }

演示:http://jsfiddle.net/9y91y3s9/1/