diff --git a/static/babystats.js b/static/babystats.js index 724d997..542dd74 100644 --- a/static/babystats.js +++ b/static/babystats.js @@ -955,49 +955,7 @@ BabyStats.prototype.updateDisplayPage_ = function() { }.bind(this)); }.bind(this)); - this.weightChart_.draw(this.weightTable_, { - title: 'Weight', - curveType: 'function', - legend: { - position: 'none', - }, - hAxis: { - gridlines: { - color: '#E97F02', - }, - textStyle: { - color: '#8A9B0F', - }, - }, - vAxis: { - gridlines: { - color: '#E97F02', - }, - textStyle: { - color: '#490A3D', - }, - title: 'Kilograms', - titleTextStyle: { - color: '#490A3D', - }, - }, - titleTextStyle: { - color: '#8A9B0F', - fontSize: 20, - }, - explorer: { - actions: [ - 'dragToZoom', - 'rightClickToReset', - ], - }, - colors: [ - '#BD1550', - ], - }); - - this.tempChart_.draw(this.tempTable_, { - title: 'Temperature (last 7 days)', + var chartOptions = { curveType: 'function', legend: { position: 'none', @@ -1010,7 +968,6 @@ BabyStats.prototype.updateDisplayPage_ = function() { color: '#8A9B0F', }, viewWindow: { - min: new Date((now - (60 * 60 * 24 * 7)) * 1000), }, }, vAxis: { @@ -1020,14 +977,14 @@ BabyStats.prototype.updateDisplayPage_ = function() { textStyle: { color: '#490A3D', }, - title: '° Celsius', titleTextStyle: { + fontSize: 17, color: '#490A3D', }, }, titleTextStyle: { - fontSize: 20, color: '#8A9B0F', + fontSize: 20, }, explorer: { actions: [ @@ -1038,7 +995,23 @@ BabyStats.prototype.updateDisplayPage_ = function() { colors: [ '#BD1550', ], - }); + }; + + var weightOptions = { + title: 'Weight', + }; + Object.assign(weightOptions, chartOptions); + weightOptions.vAxis.title = 'Kilograms'; + this.weightChart_.draw(this.weightTable_, weightOptions); + + var tempOptions = { + title: 'Temperature (last 7 days)', + }; + Object.assign(tempOptions, chartOptions); + tempOptions.vAxis.title = '° Celsius'; + tempOptions.hAxis.viewWindow.min = + new Date((now - (60 * 60 * 24 * 7)) * 1000); + this.tempChart_.draw(this.tempTable_, tempOptions); };