Skip to content

feat: conditional formatting for pivot tables#9668

Merged
nishantmonu51 merged 11 commits into
mainfrom
nishantmonu51/conditional-formatting
Jul 16, 2026
Merged

feat: conditional formatting for pivot tables#9668
nishantmonu51 merged 11 commits into
mainfrom
nishantmonu51/conditional-formatting

Conversation

@nishantmonu51

Copy link
Copy Markdown
Collaborator
  • Adds conditional formatting to pivot tables so users can color measure cells based on value rules.
  • Supported in both Explore (PivotToolbar / PivotFormattingPicker) and Canvas (inspector PivotConditionalFormatInput) dashboards.
  • Rules persist through proto state (dashboard.proto, fromProto/toProto) and are applied during column definition rendering.
  • Includes unit tests in pivot-conditional-formatting.spec.ts.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Developed in collaboration with Claude Code

Add conditional formatting support to pivot tables in both Explore and
Canvas dashboards, letting users color cells based on measure value rules.
@nishantmonu51 nishantmonu51 added Type:Feature New feature request Area:Pivot Size:L Large change: 500-1,999 lines labels Jul 10, 2026
@djbarnwal
djbarnwal marked this pull request as ready for review July 14, 2026 09:50
@nishantmonu51

Copy link
Copy Markdown
Collaborator Author

@codex: review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f28923fcf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web-common/src/features/canvas/components/pivot/index.ts
@nishantmonu51

Copy link
Copy Markdown
Collaborator Author

did an experience pass and it looks great. Thanks @djbarnwal for tuning this further.

@nishantmonu51

Copy link
Copy Markdown
Collaborator Author

@codex: review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26e52bb8c0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +384 to +386
td.cell.has-conditional-format {
background: var(--cf-bg);
color: var(--cf-color);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Let selection backgrounds override formatted cells

When a formatted cell has a dark heatmap fill and then enters an active/selected row state, this selector still wins over later rules such as .active-cell.cell and .selected-row .cell because td.cell.has-conditional-format has higher specificity. The text reset below then forces text-fg-primary while the dark conditional background remains, making selected or active values hard to read instead of showing the intended light selection background.

Useful? React with 👍 / 👎.

@nishantmonu51

Copy link
Copy Markdown
Collaborator Author

@codex: review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26e52bb8c0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

specs: PivotConditionalFormatSpec[] | undefined,
): Record<string, PivotMeasureFormatting> {
const measureFormatting: Record<string, PivotMeasureFormatting> = {};
for (const spec of specs ?? []) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard untyped conditional_format before iterating

When a canvas YAML is hand-edited or loaded with conditional_format set to a non-array value (or with a null entry), this loop throws before rendering because renderer props are untyped and the runtime canvas validators do not validate this new field. That means one malformed formatting block can crash the canvas/inspector instead of being skipped as the comment promises. Please validate the field or guard with Array.isArray and object checks before iterating.

Useful? React with 👍 / 👎.

@nishantmonu51
nishantmonu51 merged commit 12c0412 into main Jul 16, 2026
14 checks passed
@nishantmonu51
nishantmonu51 deleted the nishantmonu51/conditional-formatting branch July 16, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area:Pivot Size:L Large change: 500-1,999 lines Type:Feature New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants