Skip to content

Commit a3d3547

Browse files
pluehnelarsxschneider
authored andcommitted
Fix error with empty chart views (#134)
When aggregating over only few data points, the weekly-aggregated views might end up empty. This led to an error, because the chart generation relied on the data not to be empty. This adds a corresponding check, which prevents the error and shows an empty chart as expected. Instead of showing users empty charts, views with no data should be hidden from the users. This will be addressed separately.
1 parent f19d453 commit a3d3547

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/assets/js/charts.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ function aggregateTimeData(data, aggregationConfig)
256256

257257
function buildHistoryChartData(view)
258258
{
259+
if (view.data.length == 0)
260+
return Array();
261+
259262
const originalDataSeries = Object.keys(view.data[0]).slice(1);
260263
const dataSeries = 'series' in view ? view.series : originalDataSeries;
261264
const visibleDataSeries = 'visibleSeries' in view ? view.visibleSeries : originalDataSeries;

0 commit comments

Comments
 (0)