如何将 Flot 与 AngularJS 与 x 轴上的时间相结合

How to Integrate Flot with AngularJS with time on xaxis

我遵循了下面 Whosebug 问题中的解决方案。但我想在 xaxis 上绘制时间。但是不行

How to Integrate Flot with AngularJS?

请检查下面的 fiddle。我没有得到图形输出。

var App = angular.module('App', []);

App.controller('Ctrl', function ($scope) {
    $scope.data = [
        [1438031893270, 1],
        [1438031894270, 2],
        [1438031895269, 3],
        [1438031896269, 4],
        [1438031897278, 5],
        [1438031898270, 6],
        [1438031899268, 7],
        [1438031900277, 8],
        [1438031901269, 9]
    ];
});

App.directive('chart', function () {
    return {
        restrict: 'E',
        link: function (scope, elem, attrs) {
            var opts = {
                xaxis: {
                    mode: "time",
                    timeformat: "%H:%M:%S"
                },
            };
            var data = scope[attrs.ngModel];
            $.plot(elem, data, opts);
            elem.show();
        }
    };
});

http://jsfiddle.net/ksdqhqb2/38/

http://jsfiddle.net/ksdqhqb2/39/

检查工作演示:JSFiddle。您在 $scope.data 中错过了一个 []