Skip to content
Snippets Groups Projects
Commit 013e828e authored by Mathis Neumann's avatar Mathis Neumann
Browse files

implement y-axis label for time-series-plot

parent 8174b08b
No related branches found
No related tags found
No related merge requests found
...@@ -10,11 +10,10 @@ export default Component.extend({ ...@@ -10,11 +10,10 @@ export default Component.extend({
timeSeries: [], timeSeries: [],
options: { options: {
xaxis: { xaxis: {
mode: 'time', mode: 'time'
// timezone: 'browser' // TODO: from Server? // timezone: 'browser' // TODO: from Server?
}, },
yaxis: { yaxis: {
label: 'test'
} }
}, },
height: 300, height: 300,
...@@ -50,7 +49,9 @@ export default Component.extend({ ...@@ -50,7 +49,9 @@ export default Component.extend({
// use Ember.get because it would work with Ember.Object and plain JS // use Ember.get because it would work with Ember.Object and plain JS
const plotData = this.get('timeSeries.series') const plotData = this.get('timeSeries.series')
.map((valueObj) => [get(valueObj, 'timestamp'), get(valueObj, 'value')]); .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 // 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'); const plot = $this.plot([plotData], this.get('options')).data('plot');
this.set('plot', plot); this.set('plot', plot);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
"visionmedia-debug": "2.2", "visionmedia-debug": "2.2",
"webcola": "^3.1.3", "webcola": "^3.1.3",
"bootstrap-sass": "^3.3.6", "bootstrap-sass": "^3.3.6",
"Flot": "flot#^0.8.3" "Flot": "flot#^0.8.3",
"flot-axislabels": "https://github.com/markrcote/flot-axislabels.git"
} }
} }
...@@ -29,6 +29,7 @@ module.exports = function(defaults) { ...@@ -29,6 +29,7 @@ module.exports = function(defaults) {
app.import('bower_components/webcola/WebCola/cola.js'); 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.js'); // time-series-plot component
app.import('bower_components/Flot/jquery.flot.time.js'); app.import('bower_components/Flot/jquery.flot.time.js');
app.import('bower_components/flot-axislabels/jquery.flot.axislabels.js');
return app.toTree(); return app.toTree();
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment