SBIN2010 commented on code in PR #38119:
URL: https://github.com/apache/superset/pull/38119#discussion_r4352178343


##########
superset-frontend/plugins/plugin-chart-echarts/src/Radar/transformProps.ts:
##########
@@ -47,10 +47,27 @@ import {
 } from '../utils/series';
 import { resolveLegendLayout } from '../utils/legendLayout';
 import { defaultGrid } from '../defaults';
-import { Refs } from '../types';
+import { LabelPositionEnum, Refs } from '../types';
 import { getDefaultTooltip } from '../utils/tooltip';
 import { findGlobalMax, renderNormalizedTooltip } from './utils';
 
+// ECharts' text-position calculation swaps the vertical offset for the
+// compound "inside*" label positions on a point-symbol label target
+// (confirmed against echarts 6.1.0 on both radar and scatter series, so
+// it's an upstream quirk, not radar-specific): picking a "Top"-flavored
+// inside position renders the label below the point and vice versa for
+// "Bottom". Swap them here so the label actually lands where its name says.
+const RADAR_LABEL_POSITION_OVERRIDES: Partial<
+  Record<LabelPositionEnum, LabelPositionEnum>
+> = {
+  [LabelPositionEnum.InsideTop]: LabelPositionEnum.InsideBottom,
+  [LabelPositionEnum.InsideBottom]: LabelPositionEnum.InsideTop,
+  [LabelPositionEnum.InsideTopLeft]: LabelPositionEnum.InsideBottomLeft,
+  [LabelPositionEnum.InsideBottomLeft]: LabelPositionEnum.InsideTopLeft,
+  [LabelPositionEnum.InsideTopRight]: LabelPositionEnum.InsideBottomRight,
+  [LabelPositionEnum.InsideBottomRight]: LabelPositionEnum.InsideTopRight,
+};
+

Review Comment:
   Then the list should look like this:
   
   `const RADAR_LABEL_POSITION_OVERRIDES: Partial<
     Record<LabelPositionEnum, LabelPositionEnum>
   > = {
     [LabelPositionEnum.InsideTop]: LabelPositionEnum.InsideBottom,
     [LabelPositionEnum.InsideBottom]: LabelPositionEnum.InsideTop,
     [LabelPositionEnum.InsideLeft]: LabelPositionEnum.InsideRight,
     [LabelPositionEnum.InsideRight]: LabelPositionEnum.InsideLeft,
     [LabelPositionEnum.InsideTopLeft]: LabelPositionEnum.InsideBottomRight,
     [LabelPositionEnum.InsideBottomLeft]: LabelPositionEnum.InsideTopRight,
     [LabelPositionEnum.InsideTopRight]: LabelPositionEnum.InsideBottomLeft,
     [LabelPositionEnum.InsideBottomRight]: LabelPositionEnum.InsideTopLeft,
   };```



-- 
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]

Reply via email to