From 013e828e87f63cd9f5ed6f98104845268e36b977 Mon Sep 17 00:00:00 2001 From: Mathis Neumann <mathis@simpletechs.net> Date: Thu, 14 Jul 2016 19:26:13 +0200 Subject: [PATCH] implement y-axis label for time-series-plot --- app/components/time-series-plot.js | 7 ++++--- bower.json | 3 ++- ember-cli-build.js | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/components/time-series-plot.js b/app/components/time-series-plot.js index 2cb1de0..f701f56 100644 --- a/app/components/time-series-plot.js +++ b/app/components/time-series-plot.js @@ -10,11 +10,10 @@ export default Component.extend({ timeSeries: [], options: { xaxis: { - mode: 'time', + mode: 'time' // timezone: 'browser' // TODO: from Server? }, yaxis: { - label: 'test' } }, height: 300, @@ -50,7 +49,9 @@ export default Component.extend({ // use Ember.get because it would work with Ember.Object and plain JS const plotData = this.get('timeSeries.series') .map((valueObj) => [get(valueObj, 'timestamp'), get(valueObj, 'value')]); - this.debug('plotData', plotData); + + this.set('options.yaxis.axisLabel', this.get('timeSeries.valueLabel')); + // 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'); this.set('plot', plot); diff --git a/bower.json b/bower.json index ef080da..3237ca7 100644 --- a/bower.json +++ b/bower.json @@ -8,6 +8,7 @@ "visionmedia-debug": "2.2", "webcola": "^3.1.3", "bootstrap-sass": "^3.3.6", - "Flot": "flot#^0.8.3" + "Flot": "flot#^0.8.3", + "flot-axislabels": "https://github.com/markrcote/flot-axislabels.git" } } diff --git a/ember-cli-build.js b/ember-cli-build.js index 0cf8de4..ded4561 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -29,6 +29,7 @@ module.exports = function(defaults) { app.import('bower_components/webcola/WebCola/cola.js'); app.import('bower_components/Flot/jquery.flot.js'); // time-series-plot component app.import('bower_components/Flot/jquery.flot.time.js'); + app.import('bower_components/flot-axislabels/jquery.flot.axislabels.js'); return app.toTree(); }; -- GitLab