kokhlo commented on issue #44663: URL: https://github.com/apache/superset/issues/44663#issuecomment-5838586895
Reproduced the root cause on master by reading the render path — the Cell bar formatter rule is dropped by **two independent gates** in `plugin-chart-table/src/TableChart.tsx`: 1. **The bar container is never rendered for the rule's column.** The in-cell bar `<div>` only appears when `valueRange` is set (`L1319` `valueRange && (...)`), and `valueRange` is computed *before* formatters run, gated on `generalShowCellBars && (isMetric || isRawRecords || isPercentMetric)` (L1053-1057). `getValueRange` derives the range from the **table data**, not from any formatter — so when the operator is `=` with target `1`, the bar width/offset for the *whole column* still comes from the data range, and a `CELL_BAR` formatter contributes only its color. 2. **Even the color is dropped when `Show cell bars` is off.** `backgroundColorCellBar` is only assigned inside `if (generalShowCellBars)` (L1122-1123), so with the toggle off the rule's color silently vanishes — unlike `TEXT_COLOR`/background formatters which apply regardless of any unrelated toggle. Net effect on master: a `CELL_BAR` rule behaves like no rule at all unless the user *also* flips an unrelated "Show cell bars for all columns" checkbox, and even then it only recolors the generic gradient instead of expressing the comparator condition (`= 1` → bar only on matching cells). That's exactly what the screenshot shows — `sales` keeps the default green gradient, `seq_in_group` gets nothing. Ag-grid table and pivot-table, in contrast, simply ignore `CELL_BAR` in `getCellStyle` — but the Table is the only chart that ever renders bars, so the rule has no visible effect anywhere in Explore. **Plan** (frontend-only, `TableChart.tsx`): - Decouple the two concerns: a `CELL_BAR` formatter with a matching comparator should render its own bar (color from the formatter, width/offset from the data-driven `valueRange`) for the cells it matches, independent of the `Show cell bars` global toggle. The global toggle keeps controlling only the *default* gradient bars. - Keep `TEXT_COLOR` / background-color formatter behavior unchanged. - Regression test in `test/TableChart.test.tsx` covering: (a) `CELL_BAR` rule renders a bar with the formatter's color when `showCellBars` is off; (b) no bar when comparator doesn't match; (c) default gradient unchanged. PR within the hour. -- 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]
