Skip to content

docs(colorbar): log/date dtick string forms are not supported on color bars - #7991

Merged
camdecoster merged 1 commit into
plotly:mainfrom
CAOShurong:docs/colorbar-dtick-log-syntax
Sep 16, 2026
Merged

camdecoster merged 1 commit into
plotly:mainfrom
CAOShurong:docs/colorbar-dtick-log-syntax

Conversation

@CAOShurong

Copy link
Copy Markdown
Contributor

Fixes the documentation half of #7376.

colorbar.dtick (and coloraxis.colorbar.dtick) inherits its description from the cartesian dtick attribute, which advertises the special log forms (L, D1, D2) and date form (M). None of them works on a color bar:

  • The color-bar tick axis is mocked with type: 'linear' (mockColorBarAxis in src/components/colorbar/draw.js).
  • For a linear axis, clean_ticks.dtick silently falls back to the default step for ANY non-numeric value (src/plots/cartesian/clean_ticks.js: string dtick is only accepted on log/date axes).

Measured behavior (verified against this branch's parent with a jsdom harness, heatmap spanning 10^0 to 10^9): setting colorbar: {dtick: 'D1'} does not error and does not produce decade ticks - it degrades to a 1-unit linear step over a z-range of 1e9, i.e. ~56 million candidate tick labels (the renderer draws one garbage label per pixel of bar length, e.g. -0.056233M). The identical dtick: 'D1' on a real log y-axis produces correct decade + minor ticks, confirming the colorbar path is the broken one. Numeric dtick values work fine on the same color bar.

This PR gives the color-bar dtick attribute its own accurate description: only positive numbers are honored; the log/date string forms are silently ignored. No behavior change. test/plot-schema.json and the generated TS types are regenerated accordingly (the schema diff is exactly the new description).

If maintainers would rather implement log-scale color bars than document the limitation, the mock axis type is the single place to start - happy to attempt that instead. But as long as strings are accepted-and-discarded, the docs should not claim they work.

@camdecoster camdecoster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please rebase your branch to remove the reverted commit? Once you do that and address the comments, I'll be ready to approve.

Comment thread src/components/colorbar/attributes.js Outdated
Comment thread draftlogs/7991_fix.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please delete this file? We don't need a draftlog for this change.

@camdecoster camdecoster added the no-draftlog The associated PR doesn't require a draftlog and the CI check will be skipped. label Sep 16, 2026
…r bars

Document that dtick on color bars does not support special log/date string
forms (*L<f>*, *D1*, *D2*, *M<n>*), since color bar axes are always linear
and such string forms are silently ignored with step set to 1.
Regenerate test/plot-schema.json and schema.d.ts types.
@CAOShurong
CAOShurong force-pushed the docs/colorbar-dtick-log-syntax branch from 56782f5 to 5869085 Compare September 16, 2026 12:51

@camdecoster camdecoster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the update!

@camdecoster
camdecoster merged commit f618df5 into plotly:main Sep 16, 2026
87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-draftlog The associated PR doesn't require a draftlog and the CI check will be skipped.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants