|
|
@@ -72,18 +72,29 @@ function createGraph(
|
|
|
label: `${fieldInfo.label} (${fieldInfo.unit})`,
|
|
|
data: data.map(d => d.value),
|
|
|
backgroundColor: fieldInfo.colour, // Colour of the dots
|
|
|
- borderColor: fieldInfo.colour // Colour of the line
|
|
|
+ borderColor: fieldInfo.colour, // Colour of the line
|
|
|
+ fill: {
|
|
|
+ target: { value: 0 },
|
|
|
+ above: 'rgba(200, 200, 50, 0.2)',
|
|
|
+ below: 'rgba(50, 200, 200, 0.2)'
|
|
|
+ },
|
|
|
}]
|
|
|
},
|
|
|
options: {
|
|
|
scales: {
|
|
|
y: {
|
|
|
suggestedMin: minMax.min - (RANGE_PADDING / 2),
|
|
|
- suggestedMax: minMax.max + (RANGE_PADDING / 2)
|
|
|
+ suggestedMax: minMax.max < 0 ? 0 : minMax.max + (RANGE_PADDING / 2)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+ if(fieldInfo.key === 'light') {
|
|
|
+ const scale = config.options.scales.y;
|
|
|
+ scale.type = 'logarithmic';
|
|
|
+ }
|
|
|
+
|
|
|
new Chart(canvas, config);
|
|
|
}
|
|
|
|