From 93c4f847e40afafbaa3c44f2544bbdc9ff6eacd0 Mon Sep 17 00:00:00 2001 From: Mathis Neumann <mathis@simpletechs.net> Date: Thu, 14 Jul 2016 18:36:37 +0200 Subject: [PATCH] use timestamp instead of index in plot data --- app/components/time-series-plot.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/components/time-series-plot.js b/app/components/time-series-plot.js index 60ab1d6..7c63e4d 100644 --- a/app/components/time-series-plot.js +++ b/app/components/time-series-plot.js @@ -48,8 +48,10 @@ export default Component.extend({ } const $this = this.$(); // flot data points are tuples/arrays [x,y], graphs are arrays of these - // TODO: index is not enough, should show timestamp or other x-axis label - const plotData = this.get('timeSeries.series').map((valueObj, index) => [(Date.now() + index*10000), get(valueObj, 'value')]); // FIXME use timestamp from server + // converts unix timestamps to javascript timestamps (*1000) + // use Ember.get because it would work with Ember.Object and plain JS + const plotData = this.get('timeSeries.series') + .map((valueObj) => [get(valueObj, 'timestamp')*1000, get(valueObj, 'value')]); this.debug('plotData', plotData); // wrap in additional array since flot can handle multiple graphs at once, we only need one const plot = $this.plot([plotData], this.get('options')).data('plot'); -- GitLab