Skip to content

Commit

Permalink
Relates to plotly#3735, switch to 'circle' option, but under the hood…
Browse files Browse the repository at this point in the history
… in theory the user could now specify any valid symbol name.
  • Loading branch information
brian.kotek committed Feb 22, 2021
1 parent 9ff8ecf commit fbbcf91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/legend/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ module.exports = {
},
itemsymbol: {
valType: 'enumerated',
values: ['trace', 'constant'],
values: ['trace', 'circle'],
dflt: 'trace',
editType: 'legend',
description: [
'Determines if the legend items symbols use the symbol of the first point in each *trace*',
'or use a *constant* circle symbol.'
'or use a circle symbol.'
].join(' ')
},
itemwidth: {
Expand Down
6 changes: 3 additions & 3 deletions src/components/legend/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = function style(s, gd, legend) {
var fullLayout = gd._fullLayout;
if(!legend) legend = fullLayout.legend;
var constantItemSizing = legend.itemsizing === 'constant';
var constantItemSymbol = legend.itemsymbol === 'constant';
var customItemSymbol = legend.itemsymbol && legend.itemsymbol !== 'trace';
var itemWidth = legend.itemwidth;
var centerPos = (itemWidth + constants.itemGap * 2) / 2;
var centerTransform = strTranslate(centerPos, 0);
Expand Down Expand Up @@ -205,8 +205,8 @@ module.exports = function style(s, gd, legend) {
valToBound = cst;
}

if(constantItemSymbol && attrIn === 'marker.symbol') {
valToBound = 'circle';
if(customItemSymbol && attrIn === 'marker.symbol') {
valToBound = legend.itemsymbol;
}

if(bounds) {
Expand Down

0 comments on commit fbbcf91

Please sign in to comment.