Я пытаюсь построить некоторое использование данных Time-Series MetricsGraphics.js, но, похоже, не может заставить его работать, и я не мог найти ответ нигде в Интернете. Метрики построен на вершине D3.jsПолучение TypeError при использовании MetricsGraphics.js
Ошибка:
TypeError: Cannot read property '0' of undefined
at process_line (http://localhost:9000/bower_components/metrics-graphics/dist/metricsgraphics.js:4211:50)
at Object.charts.line.init (http://localhost:9000/bower_components/metrics-graphics/dist/metricsgraphics.js:2333:13)
at Object.charts.line (http://localhost:9000/bower_components/metrics-graphics/dist/metricsgraphics.js:2973:14)
at Object.MG.data_graphic (http://localhost:9000/bower_components/metrics-graphics/dist/metricsgraphics.js:216:20)
at init (http://localhost:9000/pages/home/home-controller.js:46:12)
at new <anonymous> (http://localhost:9000/pages/home/home-controller.js:59:5)
at invoke (http://localhost:9000/bower_components/angular/angular.js:4182:17)
at Object.instantiate (http://localhost:9000/bower_components/angular/angular.js:4190:27)
at http://localhost:9000/bower_components/angular/angular.js:8453:28
at link (http://localhost:9000/bower_components/angular-route/angular-route.js:981:26) <div class="container ng-scope" ng-view="">
А вот код, который делает объект диаграммы:
MG.data_graphic({
title: "Projector Usage",
description: "Projector Usage in Folsom.",
data: chartData,
width: 800,
height: 450,
target: "#chart",
x_accessor: "date",
y_accessor: "value"
});
Этот кусок кода, генерирующий JSON Массив объекта:
for(var x=0; x < data.length; x++){
chartData.push({
date : new Date(data[x]['timestamp']),
value : data[x]['result']['projectorsOn']
})
}