Skip to content

Commit 0fb955c

Browse files
committed
fix #4203 - fix line.width attr declaration in *contour traces
- unset dflt in contour `line.width`, explain default logic in description - reuse contour `line` declaration in contourcarpet - set hard dflt in histogram2dcontour `line.width` declaration, as histogram2dcontour trace only support level-style contours at the moment.
1 parent 8b7c737 commit 0fb955c

File tree

3 files changed

+27
-21
lines changed

3 files changed

+27
-21
lines changed

src/traces/contour/attributes.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,17 @@ module.exports = extendFlat({
239239
'Has no effect if `contours.coloring` is set to *lines*.'
240240
].join(' ')
241241
}),
242-
width: extendFlat({}, scatterLineAttrs.width, {
243-
editType: 'style+colorbars'
244-
}),
242+
width: {
243+
valType: 'number',
244+
min: 0,
245+
role: 'style',
246+
editType: 'style+colorbars',
247+
description: [
248+
'Sets the contour line width in (in px)',
249+
'Defaults to *0.5* when `contours.type` is *levels*.',
250+
'Defaults to *2* when `contour.type` is *constraint*.'
251+
].join(' ')
252+
},
245253
dash: dash,
246254
smoothing: extendFlat({}, scatterLineAttrs.smoothing, {
247255
description: [

src/traces/contourcarpet/attributes.js

+6-17
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010

1111
var heatmapAttrs = require('../heatmap/attributes');
1212
var contourAttrs = require('../contour/attributes');
13-
var contourContourAttrs = contourAttrs.contours;
14-
var scatterAttrs = require('../scatter/attributes');
1513
var colorScaleAttrs = require('../../components/colorscale/attributes');
1614

1715
var extendFlat = require('../../lib/extend').extendFlat;
1816

19-
var scatterLineAttrs = scatterAttrs.line;
17+
var contourContourAttrs = contourAttrs.contours;
2018

2119
module.exports = extendFlat({
2220
carpet: {
@@ -75,22 +73,13 @@ module.exports = extendFlat({
7573
},
7674

7775
line: {
78-
color: extendFlat({}, scatterLineAttrs.color, {
79-
description: [
80-
'Sets the color of the contour level.',
81-
'Has no if `contours.coloring` is set to *lines*.'
82-
].join(' ')
83-
}),
84-
width: scatterLineAttrs.width,
85-
dash: scatterLineAttrs.dash,
86-
smoothing: extendFlat({}, scatterLineAttrs.smoothing, {
87-
description: [
88-
'Sets the amount of smoothing for the contour lines,',
89-
'where *0* corresponds to no smoothing.'
90-
].join(' ')
91-
}),
76+
color: contourAttrs.line.color,
77+
width: contourAttrs.line.width,
78+
dash: contourAttrs.line.dash,
79+
smoothing: contourAttrs.line.smoothing,
9280
editType: 'plot'
9381
},
82+
9483
transforms: undefined
9584
},
9685

src/traces/histogram2dcontour/attributes.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,16 @@ module.exports = extendFlat({
3636
autocontour: contourAttrs.autocontour,
3737
ncontours: contourAttrs.ncontours,
3838
contours: contourAttrs.contours,
39-
line: contourAttrs.line,
39+
line: {
40+
color: contourAttrs.line.color,
41+
width: extendFlat({}, contourAttrs.line.width, {
42+
dflt: 0.5,
43+
description: 'Sets the contour line width in (in px)'
44+
}),
45+
dash: contourAttrs.line.dash,
46+
smoothing: contourAttrs.line.smoothing,
47+
editType: 'plot'
48+
},
4049
zhoverformat: histogram2dAttrs.zhoverformat,
4150
hovertemplate: histogram2dAttrs.hovertemplate
4251
},

0 commit comments

Comments
 (0)