当我点击积分时得到系列积分的索引:highcharts

时间:2015-07-08 18:16:29

标签: javascript highcharts

我想得到一个指数。当我点击点时,它应该给我那个点的索引。这里我只有样本数据,但最初我有大量数据。现在,当我点击它它给我x值,但我想要索引。请在这里查看js fiddle http://jsfiddle.net/h2sgqttt/1/

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

//See: 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: {
                min: 1435324365737,
                max: 1435324410674,
                type: "datetime",
                plotLines: [],
            }

            ,plotOptions: {
            series: {
                cursor: 'pointer',
                events: {
                    click: function(e) {
                        // Log to console
                        alert(this.name + ' clicked\n' +
                              'Index: ' + event.point.x);
                    }
                }
            }
        },
            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
            },

        }],

    }

});

0 个答案:

没有答案