Skip to content

Commit

Permalink
Fix error with empty chart views (#134)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pluehne authored and larsxschneider committed Feb 27, 2018
1 parent f19d453 commit a3d3547
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/assets/js/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ function aggregateTimeData(data, aggregationConfig)

function buildHistoryChartData(view)
{
if (view.data.length == 0)
return Array();

const originalDataSeries = Object.keys(view.data[0]).slice(1);
const dataSeries = 'series' in view ? view.series : originalDataSeries;
const visibleDataSeries = 'visibleSeries' in view ? view.visibleSeries : originalDataSeries;
Expand Down

0 comments on commit a3d3547

Please sign in to comment.