Skip to content
Open
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
1 change: 1 addition & 0 deletions draftlogs/7673_add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add support for dashed marker lines in scatter plots [[#7673](https://github.com/plotly/plotly.js/pull/7673)]
3 changes: 3 additions & 0 deletions src/components/drawing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,9 @@ drawing.singlePointStyle = function (d, sel, trace, fns, gd, pt) {
} else {
sel.style('stroke-width', (d.isBlank ? 0 : lineWidth) + 'px');

const lineDash = d.mld || (markerLine || {}).dash;
if(lineDash) drawing.dashLine(sel, lineDash, lineWidth);

var markerGradient = marker.gradient;

var gradientType = d.mgt;
Expand Down
1 change: 1 addition & 0 deletions src/components/legend/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ module.exports = function style(s, gd, legend) {
dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]);
dEdit.mlc = boundVal('marker.line.color', pickFirst);
dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5], CST_MARKER_LINE_WIDTH);
dEdit.mld = boundVal('marker.line.dash', pickFirst);
tEdit.marker = {
sizeref: 1,
sizemin: 1,
Expand Down
1 change: 1 addition & 0 deletions src/traces/scatter/arrays_to_calcdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module.exports = function arraysToCalcdata(cd, trace) {
if(marker.line) {
Lib.mergeArray(markerLine.color, cd, 'mlc');
Lib.mergeArrayCastPositive(markerLine.width, cd, 'mlw');
Lib.mergeArray(markerLine.dash, cd, 'mld');
}

var markerGradient = marker.gradient;
Expand Down
3 changes: 3 additions & 0 deletions src/traces/scatter/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,9 @@ module.exports = {
anim: true,
description: 'Sets the width (in px) of the lines bounding the marker points.'
},
dash: extendFlat({}, dash, {
editType: 'style'
Copy link
Contributor

Choose a reason for hiding this comment

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

This property already exists on the dash object, so it isn't needed here.

Suggested change
editType: 'style'

Copy link
Author

Choose a reason for hiding this comment

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

Done in 6fa75bc

}),
editType: 'calc'
},
colorScaleAttrs('marker.line', { anim: true })
Expand Down
1 change: 1 addition & 0 deletions src/traces/scatter/marker_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout
}

coerce('marker.line.width', isBubble ? 1 : 0);
coerce('marker.line.dash');
}

if(isBubble) {
Expand Down
2 changes: 1 addition & 1 deletion src/traces/scatter3d/attributes.js
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the changes for scatter3d. A dashed line isn't supported at the moment since it doesn't use SVG.

Copy link
Author

Choose a reason for hiding this comment

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

Done in ac01dc3

Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@ var attrs = (module.exports = overrideAll(
'nested'
));

attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes';
attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes';
1 change: 1 addition & 0 deletions src/traces/scattercarpet/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ module.exports = {
line: extendFlat(
{
width: scatterMarkerLineAttrs.width,
dash: scatterMarkerLineAttrs.dash,
editType: 'calc'
},
colorScaleAttrs('marker.line')
Expand Down
3 changes: 2 additions & 1 deletion src/traces/scattergeo/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ module.exports = overrideAll(
colorbar: scatterMarkerAttrs.colorbar,
line: extendFlat(
{
width: scatterMarkerLineAttrs.width
width: scatterMarkerLineAttrs.width,
dash: scatterMarkerLineAttrs.dash
},
colorAttributes('marker.line')
),
Expand Down
2 changes: 1 addition & 1 deletion src/traces/scattergl/attributes.js
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the changes for scattergl. A dashed line isn't supported at the moment since it doesn't use SVG.

Copy link
Author

Choose a reason for hiding this comment

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

Done in ac01dc3

Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ attrs.x.editType = attrs.y.editType = attrs.x0.editType = attrs.y0.editType = 'c
attrs.hovertemplate = scatterAttrs.hovertemplate;
attrs.hovertemplatefallback = scatterAttrs.hovertemplatefallback;
attrs.texttemplate = scatterAttrs.texttemplate;
attrs.texttemplatefallback = scatterAttrs.texttemplatefallback;
attrs.texttemplatefallback = scatterAttrs.texttemplatefallback;
1 change: 1 addition & 0 deletions src/traces/scatterternary/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ module.exports = {
line: extendFlat(
{
width: scatterMarkerLineAttrs.width,
dash: scatterMarkerLineAttrs.dash,
editType: 'calc'
},
colorScaleAttrs('marker.line')
Expand Down
2 changes: 1 addition & 1 deletion src/traces/splom/attributes.js
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the changes for splom. A dashed line isn't supported at the moment since it doesn't use SVG.

Copy link
Author

Choose a reason for hiding this comment

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

Done in ac01dc3

Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,4 @@ module.exports = {
},

opacity: scatterGlAttrs.opacity
};
};