rusackas commented on code in PR #41350:
URL: https://github.com/apache/superset/pull/41350#discussion_r3580418992
##########
superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts:
##########
@@ -594,17 +594,25 @@ export default function transformProps(
if (maxSecondary === undefined) maxSecondary = 1;
}
+ // A dashboard-level time grain override (e.g. via a filter or the temporal
+ // range control) is delivered in extraFormData and should take precedence
+ // over the chart's own time grain when formatting temporal axes/tooltips.
+ const resolvedTimeGrain =
+ formData.extraFormData?.time_grain_sqla ?? timeGrainSqla;
+
const tooltipFormatter =
xAxisDataType === GenericDataType.Temporal
- ? getTooltipTimeFormatter(tooltipTimeFormat)
+ ? getTooltipTimeFormatter(tooltipTimeFormat, resolvedTimeGrain)
: String;
const xAxisFormatter =
xAxisDataType === GenericDataType.Temporal
- ? getXAxisFormatter(xAxisTimeFormat, timeGrainSqla)
+ ? getXAxisFormatter(xAxisTimeFormat, resolvedTimeGrain)
: String;
const showMaxLabel =
- xAxisType === AxisType.Time && xAxisLabelRotation === 0 && !!timeGrainSqla;
+ xAxisType === AxisType.Time &&
+ xAxisLabelRotation === 0 &&
+ !!resolvedTimeGrain;
Review Comment:
Same premise issue as the other `showMaxLabel` threads — this was already
gated on `!!timeGrainSqla` on master, this PR just swaps it to
`resolvedTimeGrain` so a dashboard override also drives it. The no-grain case
is unchanged, so nothing regresses here.
--
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]