Skip to content

Commit 6343338

Browse files
committed
add name to newshape and improve descriptions
1 parent 3168078 commit 6343338

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

src/components/shapes/attributes.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,10 @@ module.exports = templatedArray('shape', {
295295
valType: 'string',
296296
dflt: '',
297297
editType: 'arraydraw',
298-
description: 'Sets the text to display with shape.'
298+
description: [
299+
'Sets the text to display with shape.',
300+
'It is also used for legend item if `name` is not provided.'
301+
].join(' ')
299302
},
300303
texttemplate: shapeTexttemplateAttrs({}, {keys: Object.keys(shapeLabelTexttemplateVars)}),
301304
font: fontAttrs({

src/components/shapes/draw_newshape/attributes.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,22 @@ module.exports = overrideAll({
134134
'*vertical* allows vertical extend.'
135135
].join(' ')
136136
},
137+
138+
name: extendFlat({}, basePlotAttributes.name, {
139+
description: [
140+
'Sets new shape name.',
141+
'The name appear as the legend item.'
142+
].join(' ')
143+
}),
144+
137145
label: {
138146
text: {
139147
valType: 'string',
140148
dflt: '',
141-
description: 'Sets the text to display with the new shape.'
149+
description: [
150+
'Sets the text to display with the new shape.',
151+
'It is also used for legend item if `name` is not provided.'
152+
].join(' ')
142153
},
143154
texttemplate: shapeTexttemplateAttrs({newshape: true}, {keys: Object.keys(shapeLabelTexttemplateVars)}),
144155
font: fontAttrs({

test/plot-schema.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3650,7 +3650,7 @@
36503650
},
36513651
"role": "object",
36523652
"text": {
3653-
"description": "Sets the text to display with the new shape.",
3653+
"description": "Sets the text to display with the new shape. It is also used for legend item if `name` is not provided.",
36543654
"dflt": "",
36553655
"editType": "none",
36563656
"valType": "string"
@@ -3804,6 +3804,11 @@
38043804
"valType": "number"
38053805
}
38063806
},
3807+
"name": {
3808+
"description": "Sets new shape name. The name appear as the legend item.",
3809+
"editType": "none",
3810+
"valType": "string"
3811+
},
38073812
"opacity": {
38083813
"description": "Sets the opacity of new shapes.",
38093814
"dflt": 1,
@@ -7379,7 +7384,7 @@
73797384
},
73807385
"role": "object",
73817386
"text": {
7382-
"description": "Sets the text to display with shape.",
7387+
"description": "Sets the text to display with shape. It is also used for legend item if `name` is not provided.",
73837388
"dflt": "",
73847389
"editType": "arraydraw",
73857390
"valType": "string"

0 commit comments

Comments
 (0)