Skip to content

Commit

Permalink
Removed: Aggregations in chart legend
Browse files Browse the repository at this point in the history
  • Loading branch information
kalyan540 committed Dec 15, 2024
1 parent 798e90d commit fd666be
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions superset-frontend/src/components/Chart/ChartRenderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const defaultProps = {
onFilterMenuOpen: () => BLANK,
onFilterMenuClose: () => BLANK,
initialValues: BLANK,
setControlValue() {},
setControlValue() { },

Check failure on line 81 in superset-frontend/src/components/Chart/ChartRenderer.jsx

View workflow job for this annotation

GitHub Actions / frontend-build

Delete `·`
triggerRender: false,
};

Expand Down Expand Up @@ -247,6 +247,29 @@ class ChartRenderer extends Component {
}
}

removeAggregations() {
if (Array.isArray(this.mutableQueriesResponse)) {
this.mutableQueriesResponse = this.mutableQueriesResponse.map(query => {
if (query.data && Array.isArray(query.data)) {
query.data = query.data.map(row => {

Check failure on line 254 in superset-frontend/src/components/Chart/ChartRenderer.jsx

View workflow job for this annotation

GitHub Actions / frontend-build

Assignment to property of function parameter 'query'
const cleanedRow = {};
Object.entries(row).forEach(([key, value]) => {
// Regex to remove aggregation functions and brackets
const cleanedKey = key.replace(/^(MAX|MIN|SUM|AVG|COUNT|COUNT_DISTINCT)\((.*?)\)$/i, '$2');

Check failure on line 258 in superset-frontend/src/components/Chart/ChartRenderer.jsx

View workflow job for this annotation

GitHub Actions / frontend-build

Replace `/^(MAX|MIN|SUM|AVG|COUNT|COUNT_DISTINCT)\((.*?)\)$/i,·'$2'` with `⏎················/^(MAX|MIN|SUM|AVG|COUNT|COUNT_DISTINCT)\((.*?)\)$/i,⏎················'$2',⏎··············`
cleanedRow[cleanedKey] = value;
});
return cleanedRow;
});
}
return query;
});

console.log('Updated data with cleaned keys:', this.mutableQueriesResponse);

Check failure on line 267 in superset-frontend/src/components/Chart/ChartRenderer.jsx

View workflow job for this annotation

GitHub Actions / frontend-build

Replace `'Updated·data·with·cleaned·keys:',·this.mutableQueriesResponse` with `⏎········'Updated·data·with·cleaned·keys:',⏎········this.mutableQueriesResponse,⏎······`
} else {
console.warn('mutableQueriesResponse is not an array or is undefined.');
}
}

render() {
const { chartAlert, chartStatus, chartId, emitCrossFilters } = this.props;

Expand Down Expand Up @@ -288,22 +311,22 @@ class ChartRenderer extends Component {
const webpackHash =
process.env.WEBPACK_MODE === 'development'
? `-${
// eslint-disable-next-line camelcase
typeof __webpack_require__ !== 'undefined' &&
// eslint-disable-next-line camelcase, no-undef
typeof __webpack_require__.h === 'function' &&
// eslint-disable-next-line no-undef, camelcase
__webpack_require__.h()
}`
// eslint-disable-next-line camelcase

Check failure on line 314 in superset-frontend/src/components/Chart/ChartRenderer.jsx

View workflow job for this annotation

GitHub Actions / frontend-build

Insert `····`
typeof __webpack_require__ !== 'undefined' &&

Check failure on line 315 in superset-frontend/src/components/Chart/ChartRenderer.jsx

View workflow job for this annotation

GitHub Actions / frontend-build

Insert `····`
// eslint-disable-next-line camelcase, no-undef

Check failure on line 316 in superset-frontend/src/components/Chart/ChartRenderer.jsx

View workflow job for this annotation

GitHub Actions / frontend-build

Insert `····`
typeof __webpack_require__.h === 'function' &&

Check failure on line 317 in superset-frontend/src/components/Chart/ChartRenderer.jsx

View workflow job for this annotation

GitHub Actions / frontend-build

Replace `········` with `············`
// eslint-disable-next-line no-undef, camelcase

Check failure on line 318 in superset-frontend/src/components/Chart/ChartRenderer.jsx

View workflow job for this annotation

GitHub Actions / frontend-build

Insert `····`
__webpack_require__.h()

Check failure on line 319 in superset-frontend/src/components/Chart/ChartRenderer.jsx

View workflow job for this annotation

GitHub Actions / frontend-build

Replace `········` with `············`
}`
: '';

let noResultsComponent;
const noResultTitle = t('No results were returned for this query');
const noResultDescription =
this.props.source === ChartSource.Explore
? t(
'Make sure that the controls are configured properly and the datasource contains data for the selected time range',
)
'Make sure that the controls are configured properly and the datasource contains data for the selected time range',
)
: undefined;
const noResultImage = 'chart.svg';
if (width > BIG_NO_RESULT_MIN_WIDTH && height > BIG_NO_RESULT_MIN_HEIGHT) {
Expand Down

0 comments on commit fd666be

Please sign in to comment.