Skip to content

Commit f618df5

Browse files
authored
Merge pull request #7991 from CAOShurong/docs/colorbar-dtick-log-syntax
docs(colorbar): log/date dtick string forms are not supported on color bars
2 parents 7f857ee + 5869085 commit f618df5

3 files changed

Lines changed: 51 additions & 39 deletions

File tree

src/components/colorbar/attributes.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,22 @@ module.exports = overrideAll(
153153
description: 'Sets the color of padded area.'
154154
},
155155
// tick and title properties named and function exactly as in axes
156+
// (except dtick: the colorbar axis is mocked as type *linear*, so the
157+
// special *log*/*date* string forms documented on `dtick` - *L<f>*,
158+
// *D1*, *D2*, *M<n>* - are silently discarded, see #7376)
156159
tickmode: axesAttrs.minor.tickmode,
157160
nticks: axesAttrs.nticks,
158161
tick0: axesAttrs.tick0,
159-
dtick: axesAttrs.dtick,
162+
dtick: extendFlat({}, axesAttrs.dtick, {
163+
description: [
164+
'Sets the step in-between ticks on this color bar. Use with `tick0`.',
165+
'Must be a positive number.',
166+
'Note: unlike on x/y axes, the special *log* and *date* string forms',
167+
'(*L<f>*, *D1*, *D2*, *M<n>*) are not supported here: this axis is',
168+
'always linear, so such strings are silently ignored and the step',
169+
'is set to 1.'
170+
].join(' ')
171+
}),
160172
tickvals: axesAttrs.tickvals,
161173
ticktext: axesAttrs.ticktext,
162174
ticks: extendFlat({}, axesAttrs.ticks, { dflt: '' }),

src/types/generated/schema.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export interface ColorBar {
248248
*/
249249
borderwidth?: number;
250250
/**
251-
* 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*
251+
* Sets the step in-between ticks on this color bar. Use with `tick0`. Must be a positive number. Note: 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 is set to 1.
252252
* Setting this also sets: tickmode = "linear"
253253
*/
254254
dtick?: any;

0 commit comments

Comments
 (0)