diff --git a/app/js/mdot.js b/app/js/mdot.js index d761614..b1327a0 100644 --- a/app/js/mdot.js +++ b/app/js/mdot.js @@ -301,6 +301,11 @@ if (mode === 6) { value = i.get(this.modes[1]); valueB = i.get(this.modes[3]); + } else { + + value = i.get(this.modes[2]); + valueB = i.get(this.modes[4]); + } } @@ -367,12 +372,24 @@ co2Axis.axisAlpha = 0; co2Axis.showFirstLabel = false; co2Axis.showLastLabel = false; - co2Axis.title = "Co2 Levels"; + co2Axis.title = 'Co2 Levels'; co2Axis.position = 'right'; self.chart.addValueAxis(co2Axis); } + if (mode === 7) { + var otherAxis = new AmCharts.ValueAxis(); + otherAxis.tickLength = 0; + otherAxis.axisAlpha = 0; + otherAxis.showFirstLabel = false; + otherAxis.showLastLabel = false; + otherAxis.title = 'Humidity'; + otherAxis.position = 'right'; + self.chart.addValueAxis(otherAxis); + + } + // GRAPH var graph = new AmCharts.AmGraph(); @@ -409,6 +426,31 @@ self.chart.addGraph(co2graph); } + + if (mode === 7) { + var otherGraph = new AmCharts.AmGraph(); + otherGraph.valueField = 'valueB'; + otherGraph.title = 'Humidity'; + otherGraph.type = 'line'; + otherGraph.valueAxis = otherAxis; // Indicate which axis should be used + otherGraph.lineColor = '#786c56'; + otherGraph.lineThickness = 1; + otherGraph.legendValueText = '[[description]]/[[value]]'; + + otherGraph.bullet = 'round'; + otherGraph.bulletSizeField = 'townSize'; // Indicate which field should be used for bullet size + otherGraph.bulletBorderColor = '#786c56'; + otherGraph.bulletBorderAlpha = 1; + otherGraph.bulletBorderThickness = 2; + otherGraph.bulletColor = '#000000'; + //Co2graph.labelText = "[[townName2]]"; // not all data points has townName2 specified, that's why labels are displayed only near some of the bullets. + otherGraph.labelPosition = 'right'; + //Co2graph.balloonText = "latitude:[[value]]"; + otherGraph.showBalloon = true; + otherGraph.dashLengthField = 'dashLength'; + self.chart.addGraph(otherGraph); + + } // CURSOR var chartCursor = new AmCharts.ChartCursor(); chartCursor.valueLineEnabled = true; @@ -419,15 +461,15 @@ var chartScrollbar = new AmCharts.ChartScrollbar(); self.chart.addChartScrollbar(chartScrollbar); - /* // HORIZONTAL GREEN RANGE - var guide = new AmCharts.Guide(); - guide.value = 525; - guide.toValue = 575; - guide.fillColor = '#00CC00'; - guide.inside = true; - guide.fillAlpha = 0.2; - guide.lineAlpha = 0; - valueAxis.addGuide(guide);*/ + /* // HORIZONTAL GREEN RANGE + var guide = new AmCharts.Guide(); + guide.value = 525; + guide.toValue = 575; + guide.fillColor = '#00CC00'; + guide.inside = true; + guide.fillAlpha = 0.2; + guide.lineAlpha = 0; + valueAxis.addGuide(guide);*/ // WRITE