YousufFFFF commented on code in PR #36306:
URL: https://github.com/apache/superset/pull/36306#discussion_r2582789488


##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts:
##########
@@ -433,69 +433,47 @@ export function getLegendProps(
   type: LegendType,
   orientation: LegendOrientation,
   show: boolean,
-  theme: SupersetTheme,
+  theme?: SupersetTheme,
   zoomable = false,
   legendState?: LegendState,
   padding?: LegendPaddingType,
 ): LegendComponentOption | LegendComponentOption[] {
+  const isHorizontal =
+    orientation === LegendOrientation.Top ||
+    orientation === LegendOrientation.Bottom;
+
+  // If user explicitly selected scroll, keep it.
+  // Otherwise, for horizontal legends (top/bottom) default to scroll
+  // so long legends don't overlap the chart.
+  const effectiveType =
+    type === LegendType.Scroll || !isHorizontal ? type : LegendType.Scroll;
+
   const legend: LegendComponentOption | LegendComponentOption[] = {

Review Comment:
   There is never an array being used for legend, so I will simplify it to just:
   
   const legend: LegendComponentOption = { ... }
   
   This removes the unnecessary union type and casting throughout the switch 
cases.



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