rusackas commented on code in PR #44550:
URL: https://github.com/apache/superset/pull/44550#discussion_r4078296597
##########
superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx:
##########
@@ -146,35 +146,52 @@ export const xAxisSortControl = {
const columns = [controls?.x_axis?.value as QueryFormColumn].filter(
Boolean,
);
- const isSingleSortAvailable =
- ensureIsArray(controls?.groupby?.value).length === 0;
- const isMultiSortAvailable =
+ const isMultiSeries =
!!ensureIsArray(controls?.groupby?.value).length ||
ensureIsArray(controls?.metrics?.value).length > 1;
const metrics = [
...ensureIsArray(controls?.metrics?.value as QueryFormMetric),
controls?.timeseries_limit_metric?.value as QueryFormMetric,
].filter(Boolean);
const metricLabels = [...new Set(metrics.map(getMetricLabel))];
+ // The x-axis column and every metric (the "Sort By" limit metric
+ // included) can order the axis with or without dimensions: the backend
+ // sort operator handles the single-series case, and the chart resolves
+ // a metric's pivoted columns through `label_map` when dimensions split
+ // it into several series.
+ const fieldOptions = [
+ ...columns.map(column => {
+ const value = getColumnLabel(column);
+ return { value, label: dataset?.verbose_map?.[value] || value };
+ }),
+ ...metricLabels.map(value => ({
+ value,
+ label: dataset?.verbose_map?.[value] || value,
+ })),
+ ];
Review Comment:
Fair enough, folded both into a `withVerboseLabel` helper.
--
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]