madhushreeag commented on code in PR #37555:
URL: https://github.com/apache/superset/pull/37555#discussion_r2843298142
##########
superset-frontend/packages/superset-ui-chart-controls/src/operators/utils/extractExtraMetrics.ts:
##########
@@ -26,16 +26,21 @@ import {
export function extractExtraMetrics(
formData: QueryFormData,
): QueryFormMetric[] {
- const { groupby, timeseries_limit_metric, x_axis_sort, metrics } = formData;
+ const { groupby, timeseries_limit_metric, metrics } = formData;
const extra_metrics: QueryFormMetric[] = [];
const limitMetric = ensureIsArray(timeseries_limit_metric)[0];
- if (
- !(groupby || []).length &&
- limitMetric &&
- getMetricLabel(limitMetric) === x_axis_sort &&
- !metrics?.some(metric => getMetricLabel(metric) === x_axis_sort)
- ) {
- extra_metrics.push(limitMetric);
+
+ if (!(groupby || []).length && limitMetric) {
+ const limitMetricLabel = getMetricLabel(limitMetric);
+ const isLimitMetricInMetrics = metrics?.some(
+ metric => getMetricLabel(metric) === limitMetricLabel,
+ );
+
+ // Add limit metric as extra if it's not already in display metrics
+ // This ensures it's fetched for sorting but not displayed as a separate
series
+ if (!isLimitMetricInMetrics) {
+ extra_metrics.push(limitMetric);
+ }
}
Review Comment:
removed this code bit as it was not connected to this PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]