new graph

This commit is contained in:
Martin Donnelly 2016-08-15 16:29:24 +01:00
parent 3afe833595
commit 40871afd81

View File

@ -234,6 +234,7 @@
template: _.template($('#AMChart-template').html()), template: _.template($('#AMChart-template').html()),
initialize: function() { initialize: function() {
this.modes = ['', 'lux', 'temp', 'co2', 'humid', 'noise']; this.modes = ['', 'lux', 'temp', 'co2', 'humid', 'noise'];
this.titles = ['','Light Levels','Temperature','Co2 Levels','Humidity','Sound'];
this.mode = 0; this.mode = 0;
// Config AMChart // Config AMChart
@ -289,7 +290,7 @@
var mode = parseInt(this.mode); var mode = parseInt(this.mode);
console.log('mode:', mode, this.mode); console.log('mode:', mode, this.mode);
debugger;
_(this.collection.models).each(function(i) { _(this.collection.models).each(function(i) {
var dt = i.get('dt'); var dt = i.get('dt');
var obj; var obj;
@ -356,6 +357,8 @@
valueAxis.axisAlpha = 0; valueAxis.axisAlpha = 0;
valueAxis.showFirstLabel = false; valueAxis.showFirstLabel = false;
valueAxis.showLastLabel = false; valueAxis.showLastLabel = false;
valueAxis.title = this.titles[this.mode];
valueAxis.position = 'left';
self.chart.addValueAxis(valueAxis); self.chart.addValueAxis(valueAxis);
if (mode === 6) { if (mode === 6) {
@ -364,6 +367,7 @@
co2Axis.axisAlpha = 0; co2Axis.axisAlpha = 0;
co2Axis.showFirstLabel = false; co2Axis.showFirstLabel = false;
co2Axis.showLastLabel = false; co2Axis.showLastLabel = false;
co2Axis.title = "Co2 Levels";
co2Axis.position = 'right'; co2Axis.position = 'right';
self.chart.addValueAxis(co2Axis); self.chart.addValueAxis(co2Axis);