Skip to content

Fix line.width attr declaration in *contour traces #4218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 11 additions & 3 deletions src/traces/contour/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,17 @@ module.exports = extendFlat({
'Has no effect if `contours.coloring` is set to *lines*.'
].join(' ')
}),
width: extendFlat({}, scatterLineAttrs.width, {
editType: 'style+colorbars'
}),
width: {
valType: 'number',
min: 0,
role: 'style',
editType: 'style+colorbars',
description: [
'Sets the contour line width in (in px)',
'Defaults to *0.5* when `contours.type` is *levels*.',
'Defaults to *2* when `contour.type` is *constraint*.'
].join(' ')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's the corresponding default logic:

coerce('line.width', 0.5);

reused by contourcarpet and histogram2dcontour

coerce('line.width', 2);

reused by contourcarpet

},
dash: dash,
smoothing: extendFlat({}, scatterLineAttrs.smoothing, {
description: [
Expand Down
23 changes: 6 additions & 17 deletions src/traces/contourcarpet/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@

var heatmapAttrs = require('../heatmap/attributes');
var contourAttrs = require('../contour/attributes');
var contourContourAttrs = contourAttrs.contours;
var scatterAttrs = require('../scatter/attributes');
var colorScaleAttrs = require('../../components/colorscale/attributes');

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

var scatterLineAttrs = scatterAttrs.line;
var contourContourAttrs = contourAttrs.contours;

module.exports = extendFlat({
carpet: {
Expand Down Expand Up @@ -75,22 +73,13 @@ module.exports = extendFlat({
},

line: {
color: extendFlat({}, scatterLineAttrs.color, {
description: [
'Sets the color of the contour level.',
'Has no if `contours.coloring` is set to *lines*.'
].join(' ')
}),
width: scatterLineAttrs.width,
dash: scatterLineAttrs.dash,
smoothing: extendFlat({}, scatterLineAttrs.smoothing, {
description: [
'Sets the amount of smoothing for the contour lines,',
'where *0* corresponds to no smoothing.'
].join(' ')
}),
color: contourAttrs.line.color,
width: contourAttrs.line.width,
dash: contourAttrs.line.dash,
smoothing: contourAttrs.line.smoothing,
editType: 'plot'
},

transforms: undefined
},

Expand Down
11 changes: 10 additions & 1 deletion src/traces/histogram2dcontour/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ module.exports = extendFlat({
autocontour: contourAttrs.autocontour,
ncontours: contourAttrs.ncontours,
contours: contourAttrs.contours,
line: contourAttrs.line,
line: {
color: contourAttrs.line.color,
width: extendFlat({}, contourAttrs.line.width, {
dflt: 0.5,
description: 'Sets the contour line width in (in px)'
}),
dash: contourAttrs.line.dash,
smoothing: contourAttrs.line.smoothing,
editType: 'plot'
},
zhoverformat: histogram2dAttrs.zhoverformat,
hovertemplate: histogram2dAttrs.hovertemplate
},
Expand Down