madhushreeag commented on code in PR #37531:
URL: https://github.com/apache/superset/pull/37531#discussion_r2848834745
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -513,14 +562,34 @@ export default function transformProps(
isHorizontal,
);
- const legendData = rawSeries
- .filter(
- entry =>
- extractForecastSeriesContext(entry.name || '').type ===
- ForecastSeriesEnum.Observation,
- )
- .map(entry => entry.name || '')
- .concat(extractAnnotationLabels(annotationLayers));
+ const legendData = showColorByXAxis && groupBy.length === 0 && series.length
> 0
+ ? // When showColorByXAxis is enabled, show only x-axis values
+ (() => {
+ const firstSeries = series[0];
+ if (firstSeries && Array.isArray(firstSeries.data)) {
+ return (firstSeries.data as any[]).map(point => {
+ if (point && typeof point === 'object' && 'value' in point) {
+ const val = point.value;
+ return String(Array.isArray(val) ? val[0] : val);
+ } else if (Array.isArray(point)) {
+ return String(point[0]);
+ } else {
+ return String(point);
+ }
+ });
+ }
Review Comment:
Fixed - The fix deduplicates and filters legendData the same way as the
hidden series fix earlier — Array.from(new Set(names)) removes duplicates, and
.filter(name => name !== '' && name !==
'undefined' && name !== 'null') removes empty/invalid entries from
null/undefined x-axis values.
--
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]