Code simplification, more chart layout cleanup.

This commit is contained in:
Ian Gulliver
2016-01-06 00:28:07 -08:00
parent b946f18eb5
commit 259e6680d3

View File

@@ -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);
};