rusackas commented on code in PR #36306:
URL: https://github.com/apache/superset/pull/36306#discussion_r2578212037
##########
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[] = {
- orient: [LegendOrientation.Top, LegendOrientation.Bottom].includes(
- orientation,
- )
- ? 'horizontal'
- : 'vertical',
+ orient: isHorizontal ? 'horizontal' : 'vertical',
show,
- type,
- selected: legendState,
- selector: ['all', 'inverse'],
- selectorLabel: {
- fontFamily: theme.fontFamily,
- fontSize: theme.fontSizeSM,
- color: theme.colorText,
- borderColor: theme.colorBorder,
- },
+ type: effectiveType,
};
- const MIN_LEGEND_WIDTH = 0;
Review Comment:
Are we sure we want to remove all these settings? Looks dangerous.
--
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]