Fix gaps in history charts (#8293)

This commit is contained in:
Mike Morrison 2021-02-01 02:52:12 -08:00 committed by GitHub
parent 3659cf7c87
commit 3d4a0b02e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,6 +139,15 @@ class StateHistoryChartLine extends LocalizeMixin(PolymerElement) {
return; return;
} }
data.forEach((d, i) => { data.forEach((d, i) => {
if (datavalues[i] === null && prevValues && prevValues[i] !== null) {
// null data values show up as gaps in the chart.
// If the current value for the dataset is null and the previous
// value of the data set is not null, then add an 'end' point
// to the chart for the previous value. Otherwise the gap will
// be too big. It will go from the start of the previous data
// value until the start of the next data value.
d.data.push({ x: timestamp, y: prevValues[i] });
}
d.data.push({ x: timestamp, y: datavalues[i] }); d.data.push({ x: timestamp, y: datavalues[i] });
}); });
prevValues = datavalues; prevValues = datavalues;