bito-code-review[bot] commented on PR #44321:
URL: https://github.com/apache/superset/pull/44321#issuecomment-5690510684
<!-- Bito Reply -->
The flagged issue is correct. When category labels are long, they can exceed
the reserved grid space, causing clipping or pushing the plotting area out of
view. The current PR already implements a robust fix for this by:
1. **Improving Measurement:** It now calculates the label width using the
actual ink extent (`actualBoundingBoxLeft` + `actualBoundingBoxRight`) rather
than just the advance width, ensuring descenders and italics are accounted for.
2. **Ensuring Consistency:** It explicitly sets `fontSize` and `fontFamily`
on the ECharts `markLine` label to match the measurement context, preventing
discrepancies between measured and rendered sizes.
3. **Refining Grid Layout:** It applies `Math.ceil()` to the calculated
`maxCategoryLabelWidth` to ensure the grid `left` offset is always sufficient.
Since this PR already contains the fix for the reported issue, no further
action is required for this specific comment.
**superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts**
```
if (measureContext) {
const metrics = measureContext.measureText(name);
const inkWidth =
(metrics.actualBoundingBoxLeft ?? 0) +
(metrics.actualBoundingBoxRight ?? 0);
labelWidth = Math.max(metrics.width, inkWidth);
}
```
--
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]