Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
提交
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions draftlogs/7991_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Correct the `colorbar.dtick` (and `coloraxis.colorbar.dtick`) description: the special *log*/*date* string forms (*L<f>*, *D1*, *D2*, *M<n>*) are not supported on color bars - the internal color-bar axis is always linear, so such strings are silently ignored. The attribute now documents that only positive numbers are honored [[#7991](https://github.com/plotly/plotly.js/pull/7991)]
14 changes: 13 additions & 1 deletion src/components/colorbar/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,22 @@ module.exports = overrideAll(
description: 'Sets the color of padded area.'
},
// tick and title properties named and function exactly as in axes
// (except dtick: the colorbar axis is mocked as type *linear*, so the
// special *log*/*date* string forms documented on `dtick` - *L<f>*,
// *D1*, *D2*, *M<n>* - are silently discarded, see #7376)
tickmode: axesAttrs.minor.tickmode,
nticks: axesAttrs.nticks,
tick0: axesAttrs.tick0,
dtick: axesAttrs.dtick,
dtick: extendFlat({}, axesAttrs.dtick, {
description: [
'Sets the step in-between ticks on this color bar. Use with `tick0`.',
'Must be a positive number.',
'Unlike on x/y axes, the special *log* and *date* string forms',
'(*L<f>*, *D1*, *D2*, *M<n>*) are NOT supported here: this axis is',
'always linear, so such strings are silently ignored and the step',
'falls back to its default.'
].join(' ')
}),
tickvals: axesAttrs.tickvals,
ticktext: axesAttrs.ticktext,
ticks: extendFlat({}, axesAttrs.ticks, { dflt: '' }),
Expand Down
2 changes: 1 addition & 1 deletion src/types/generated/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export interface ColorBar {
*/
borderwidth?: number;
/**
* Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to *log* and *date* axes. If the axis `type` is *log*, then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. *log* has several special values; *L<f>*, where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = *L0.5* will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use *D1* (all digits) or *D2* (only 2 and 5). `tick0` is ignored for *D1* and *D2*. If the axis `type` is *date*, then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. *date* also has special values *M<n>* gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to *2000-01-15* and `dtick` to *M3*. To set ticks every 4 years, set `dtick` to *M48*
* Sets the step in-between ticks on this color bar. Use with `tick0`. Must be a positive number. Unlike on x/y axes, the special *log* and *date* string forms (*L<f>*, *D1*, *D2*, *M<n>*) are NOT supported here: this axis is always linear, so such strings are silently ignored and the step falls back to its default.
* Setting this also sets: tickmode = "linear"
*/
dtick?: any;
Expand Down
Loading
Loading