bito-code-review[bot] commented on PR #43181:
URL: https://github.com/apache/superset/pull/43181#issuecomment-5297476655
<!-- Bito Reply -->
The flagged issue is correct. The current logic in `transformProps.ts`
incorrectly includes fully collapsed rollup levels in the distribution used for
color formatting, which causes grand totals and other uncolored levels to
distort the color scale. To resolve this, you should refine the
`isColorFormattedLevel` predicate to exclude levels that only contribute to
uncolored total rows or columns.
Here is the corrected implementation for
`superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/transformProps.ts`:
```typescript
const isColorFormattedLevel = ({ groupby }: QueryData) =>
metricsLayout === MetricsLayoutEnum.ROWS
? groupby.columns.length > 0 || displayColumns.length === 0
: groupby.rows.length > 0 || displayRows.length === 0;
```
This change ensures that only levels containing actual leaf or subtotal data
are included in the color formatter's domain. Would you like me to fetch the
remaining comments on this PR to check if there are other issues you would like
to address?
**superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/transformProps.ts**
```
const isColorFormattedLevel = ({ groupby }: QueryData) =>
metricsLayout === MetricsLayoutEnum.ROWS
? groupby.columns.length > 0 || displayColumns.length === 0
: groupby.rows.length > 0 || displayRows.length === 0;
```
--
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]