Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- date formatting on all rows
- fix double report execution after wizard close
- correct drilldown aggregation for numeric dimension indices
- adjust time aggregation dimension after drilldown

## 5.8.0 - 2025-07-29
### Added
Expand Down
36 changes: 34 additions & 2 deletions js/visualization.js
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,35 @@ OCA.Analytics.Visualization = {
return data;
},

/**
* Translate a dimension index after drilldown removed columns.
*
* @param {string|number} dimension - Original dimension index before drilldown.
* @param {Object} drilldown - Drilldown filter mapping column indices to visibility.
* @returns {number} Adjusted zero-based index or -1 if the column was removed.
*/
resolveDimensionIndex: function (dimension, drilldown) {
let idx = parseInt(String(dimension).match(/\d+$/)?.[0], 10);
if (isNaN(idx)) {
return -1;
}
if (drilldown && typeof drilldown === 'object') {
const removed = Object.keys(drilldown)
.filter(key => drilldown[key] === false)
.map(key => parseInt(String(key).match(/\d+$/)?.[0], 10))
.sort((a, b) => a - b);
for (const r of removed) {
if (r === idx) {
return -1;
}
if (r < idx) {
idx--;
}
}
}
return idx;
},

/**
* Group time based dimensions by day/week/month/year.
*
Expand All @@ -1113,8 +1142,11 @@ OCA.Analytics.Visualization = {
return data;
}

const dimension = parseInt(tg.dimension.match(/\d+$/)?.[0], 10) - 1;
if (isNaN(dimension)) {
const dimension = OCA.Analytics.Visualization.resolveDimensionIndex(
tg.dimension,
data.options.filteroptions?.drilldown
);
if (dimension < 0) {
return data;
}

Expand Down