Skip to content

[SIP] Add Palette Type Control to Treemap Chart #36848

@hassaansaleem28

Description

@hassaansaleem28

[SIP] Add Palette Type Control to Treemap Chart

Motivation

Currently, Treemap charts in Superset always rely on categorical palettes.
There is no support for automatically switching to sequential palettes when metric values vary, and users have no explicit way to choose between sequential and categorical palettes.

This SIP proposes to improve the user experience by:

  1. Introducing automatic palette logic (via PR #36847, pending review).
  2. Exposing a new form control so users can override the behavior and explicitly select their preferred palette type.

Proposed Change

Add a new form control in Treemap chart settings:

Implementation details:

  • Add control in controlPanel.ts.
  • Update transformProps.ts to respect formData.paletteType.
  • Extend Jest tests in transformProps.test.ts to cover all three modes.
  • Default remains auto to avoid breaking existing dashboards.

Screenshots/mocks:

  • Dropdown in chart settings showing palette type options.
  • Example Treemap with sequential palette vs categorical palette.

New or Changed Public Interfaces

  • Chart Controls: New paletteType option in Treemap chart control panel.
  • Visualization Behavior: Treemap rendering logic updated to respect user choice.
  • No changes to REST endpoints, CLI, or deployment.

New dependencies

  • None. Uses existing getSequentialSchemeRegistry and getCategoricalSchemeRegistry utilities already in Superset.

Migration Plan and Compatibility

  • No database migrations required.
  • Default remains auto, so existing dashboards continue to render identically.
  • Users can opt into sequential/categorical explicitly if desired.

Documentation

  • Update Superset user documentation to include the new Palette Type option in Treemap chart settings.
  • Add screenshots showing how to select sequential vs categorical palettes.
  • Clarify that auto is the default and preserves existing behavior.
  • Update the Charts → Treemap section in Superset docs to reflect this new control.

Rejected Alternatives

  • Keep only auto logic: Would improve defaults but still leave users without control.
  • Expose only sequential palettes: Too restrictive; categorical palettes are still useful for discrete metrics.
  • Custom palette editor: Out of scope for this SIP; more complex and requires separate discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    design:proposalDesign proposalssipSuperset Improvement Proposalviz:charts:treemapRelated to the Treemap chart

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions