msyavuz commented on code in PR #33723:
URL: https://github.com/apache/superset/pull/33723#discussion_r2137702852
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -257,7 +258,22 @@ export default function transformProps(
rawSeries.map(series => series.name as string),
);
const isAreaExpand = stack === StackControlsValue.Expand;
- const xAxisDataType = dataTypes?.[xAxisLabel] ?? dataTypes?.[xAxisOrig];
+ let xAxisDataType = dataTypes?.[xAxisLabel] ?? dataTypes?.[xAxisOrig];
+
+ // Defensive check for xAxisDataType in case it is not provided by the
backend.
+ if (xAxisDataType === undefined && data.length > 0) {
+ const firstValue = data[0][xAxisLabel];
+ if (
+ firstValue !== null &&
+ !Number.isNaN(new Date(firstValue as string | number).getTime())
+ ) {
Review Comment:
This is an elegant solution! But since i can't reproduce the problem, i went
with the simpler one that should always exist. I can do a refactor to something
similar to yours after we confirm this works.
--
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]