sadpandajoe commented on code in PR #44147:
URL: https://github.com/apache/superset/pull/44147#discussion_r4169387301
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts:
##########
@@ -932,6 +949,65 @@ export function getLegendProps(
const getLegendWidth = (paddingWidth: number) =>
Math.max(paddingWidth - MARGIN_GUTTER, MIN_LEGEND_WIDTH);
+ /**
+ * Returns a legend tooltip config that:
+ * 1. Only appears when the label is actually truncated (name wider than
maxTextWidth)
+ * 2. Positions the tooltip ABOVE the legend item to avoid overlapping the
chart
+ *
+ * Accessibility note: this tooltip is hover-only; keyboard and screen-reader
+ * users cannot currently discover the untruncated name. A non-hover
+ * affordance (e.g. aria-label or title attribute on the legend item) is
+ * tracked as a separate enhancement.
+ */
+ const makeLegendTooltip = (
+ maxTextWidth: number,
+ ): NonNullable<LegendComponentOption['tooltip']> => ({
+ show: true,
+ appendToBody: true, // Use DOM body to prevent clipping
Review Comment:
This `appendToBody` property is not accepted by the declared legend-tooltip
type, so the ECharts package build fails with TS2353 and `lint-frontend` exits
2. Could the body-attachment option be configured at the chart-level tooltip
instead of this component-tooltip object?
##########
superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts:
##########
@@ -554,10 +556,18 @@ export default function transformProps(
position: 'outer',
alignTo: 'none',
bleedMargin: 5,
+ ...(labelMaxWidth > 0 && {
+ width: labelMaxWidth,
Review Comment:
Setting `label.width` disables ECharts’ viewport-aware width constraint:
with a 600Ă—600 pie, two equal slices, a 70% radius and a 120px outside-label
limit, the right label starts around x=560 and its ellipsis falls beyond the
canvas. Could this limit preserve the available-space constraint so labels
still truncate visibly when the chart is narrow or resized?
--
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]