bito-code-review[bot] commented on code in PR #35459:
URL: https://github.com/apache/superset/pull/35459#discussion_r2678639306
##########
superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts:
##########
@@ -95,26 +97,36 @@ function getTotalValuePadding({
top: donut ? 'middle' : '0',
left: 'center',
};
+ // When half, the donut is centered at 70% - 1% so that the total does not
go beyond the limits
+ const HALF_DONUT_BASE_POSITION = 69;
+ // When halfway, the donut is centered at 70% - 1% to keep the total from
going over the limit - 0.5% legend offset
+ const HALF_DONUT_TOP_OFFSET = 68.5;
+ // When donut, the donut is centered at 50%
+ const DONUT_OFFSET = 50;
+ const getDonutBase = () => (half ? HALF_DONUT_TOP_OFFSET : DONUT_OFFSET);
+ if (half) {
+ padding.top = donut
+ ? `${HALF_DONUT_BASE_POSITION + (chartPadding.top / height / 2) * 100}%`
+ : `${(chartPadding.top / height) * 100}%`;
+ }
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incorrect half donut text positioning</b></div>
<div id="fix">
The if (half) block sets padding.top to one value, then if
(chartPadding.top) overwrites it with a different value, causing incorrect
total text positioning for half donuts with legends.
</div>
</div>
<small><i>Code Review Run #bd811f</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]