Skip to content

Commit

Permalink
Merge pull request #1400 from kellyi/feature/update-water-quality-vis…
Browse files Browse the repository at this point in the history
…ualizations

Remove biochemical oxygen demand component

Connects #1174
  • Loading branch information
kellyi authored Jul 27, 2016
2 parents 8f813df + 85389e7 commit 89a57db
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/mmw/apps/modeling/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,10 @@ def aoi_resolution(area_of_interest):


def format_quality(model_output):
measures = ['Biochemical Oxygen Demand',
'Total Suspended Solids',
measures = ['Total Suspended Solids',
'Total Nitrogen',
'Total Phosphorus']
codes = ['bod', 'tss', 'tn', 'tp']
codes = ['tss', 'tn', 'tp']

def fn(input):
measure, code = input
Expand Down
4 changes: 4 additions & 0 deletions src/mmw/js/src/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ var utils = {
}
},

filterOutOxygenDemand: function(element) {
return element.measure !== "Biochemical Oxygen Demand";
},

// Reverse sorting of a Backbone Collection.
// Taken from http://stackoverflow.com/a/12220415/2053314
reverseSortBy: function(sortByFunction) {
Expand Down
15 changes: 8 additions & 7 deletions src/mmw/js/src/modeling/tr55/quality/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ var $ = require('jquery'),
barChartTmpl = require('../../../core/templates/barChart.html'),
resultTmpl = require('./templates/result.html'),
tableRowTmpl = require('./templates/tableRow.html'),
tableTmpl = require('./templates/table.html');
tableTmpl = require('./templates/table.html'),
utils = require('../../../core/utils.js');

var ResultView = Marionette.LayoutView.extend({
className: 'tab-pane',
Expand Down Expand Up @@ -51,8 +52,9 @@ var ResultView = Marionette.LayoutView.extend({
}));
} else {
var dataCollection = new Backbone.Collection(
this.model.get('result').quality
);
this.model.get('result').quality.filter(
utils.filterOutOxygenDemand
));

this.tableRegion.show(new TableView({
aoiVolumeModel: this.aoiVolumeModel,
Expand Down Expand Up @@ -168,10 +170,9 @@ var CompareChartView = Marionette.ItemView.extend({
}

var chartEl = this.$el.find('.bar-chart').get(0),
result = this.model.get('result').quality,
result = this.model.get('result').quality.filter(utils.filterOutOxygenDemand),
aoiVolumeModel = this.options.aoiVolumeModel,
seriesDisplayNames = ['Oxygen Demand',
'Suspended Solids',
seriesDisplayNames = ['Suspended Solids',
'Nitrogen',
'Phosphorus'],
data,
Expand All @@ -181,7 +182,7 @@ var CompareChartView = Marionette.ItemView.extend({
if (result) {
data = getData(result, seriesDisplayNames);
chartOptions = {
seriesColors: ['#1589ff', '#4aeab3', '#4ebaea', '#329b9c'],
seriesColors: ['#4aeab3', '#4ebaea', '#329b9c'],
yAxisLabel: 'Loading Rate (kg/ha)',
yAxisUnit: 'kg/ha',
margin: {top: 20, right: 0, bottom: 40, left: 60},
Expand Down

0 comments on commit 89a57db

Please sign in to comment.