-
-
Notifications
You must be signed in to change notification settings - Fork 2k
add options to include shapes and newshape in legends
#6653
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
Changes from 5 commits
6545353
786d9e6
2d7d3da
332a0dd
8a0f60a
f0c6b72
d3004c1
51a28f9
0fa6914
4728e86
2f1f812
3511eb4
8e181cc
6c0ab2e
7870720
ef0fe6f
2e77fc7
58b1cb1
3168078
6343338
7bf5029
948fd02
e5a600d
5b02b62
b35add8
6111aba
5c0168c
15986b8
759dbb4
9123425
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - add options to include shapes and `newshape` in legends [[#6653](https://github.com/plotly/plotly.js/pull/6653)] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,19 +7,80 @@ var dash = require('../drawing/attributes').dash; | |
| var extendFlat = require('../../lib/extend').extendFlat; | ||
| var templatedArray = require('../../plot_api/plot_template').templatedArray; | ||
| var axisPlaceableObjs = require('../../constants/axis_placeable_objects'); | ||
| var basePlotAttributes = require('../../plots/attributes'); | ||
| var shapeTexttemplateAttrs = require('../../plots/template_attributes').shapeTexttemplateAttrs; | ||
| var shapeLabelTexttemplateVars = require('./label_texttemplate'); | ||
|
|
||
| module.exports = templatedArray('shape', { | ||
| visible: { | ||
| visible: extendFlat({}, basePlotAttributes.visible, { | ||
| editType: 'calc+arraydraw', | ||
| description: [ | ||
| 'Determines whether or not this shape is visible.', | ||
| 'If *legendonly*, the shape is not drawn,', | ||
| 'but can appear as a legend item', | ||
| '(provided that the legend itself is visible).' | ||
| ].join(' ') | ||
| }), | ||
|
|
||
| showlegend: { | ||
| valType: 'boolean', | ||
| dflt: true, | ||
| dflt: false, | ||
| editType: 'calc+arraydraw', | ||
| description: [ | ||
| 'Determines whether or not this shape is visible.' | ||
| 'Determines whether or not this', | ||
| 'shape is shown in the legend.' | ||
| ].join(' ') | ||
| }, | ||
|
|
||
| legend: extendFlat({}, basePlotAttributes.legend, { | ||
| editType: 'calc+arraydraw', | ||
| description: [ | ||
| 'Sets the reference to a legend to show this shape in.', | ||
| 'References to these legends are *legend*, *legend2*, *legend3*, etc.', | ||
| 'Settings for these legends are set in the layout, under', | ||
| '`layout.legend`, `layout.legend2`, etc.' | ||
| ].join(' ') | ||
| }), | ||
|
|
||
| legendgroup: extendFlat({}, basePlotAttributes.legendgroup, { | ||
| editType: 'calc+arraydraw', | ||
| description: [ | ||
| 'Sets the legend group for this shape.', | ||
| 'Traces and shapes part of the same legend group hide/show at the same time', | ||
| 'when toggling legend items.' | ||
| ].join(' ') | ||
| }), | ||
|
|
||
| legendgrouptitle: { | ||
| text: extendFlat({}, basePlotAttributes.legendgrouptitle.text, { | ||
| editType: 'calc+arraydraw' | ||
| }), | ||
| font: fontAttrs({ | ||
| editType: 'calc+arraydraw', | ||
| description: [ | ||
| 'Sets this legend group\'s title font.' | ||
| ].join(' '), | ||
| }), | ||
| editType: 'calc+arraydraw', | ||
| }, | ||
|
|
||
| legendrank: extendFlat({}, basePlotAttributes.legendrank, { | ||
| editType: 'calc+arraydraw', | ||
| description: [ | ||
| 'Sets the legend rank for this shape.', | ||
| 'Items and groups with smaller ranks are presented on top/left side while', | ||
| 'with *reversed* `legend.traceorder` they are on bottom/right side.', | ||
| 'The default legendrank is 1000,', | ||
| 'so that you can use ranks less than 1000 to place certain items before all unranked items,', | ||
| 'and ranks greater than 1000 to go after all unranked items.' | ||
|
||
| ].join(' ') | ||
| }), | ||
|
|
||
| legendwidth: extendFlat({}, basePlotAttributes.legendwidth, { | ||
| editType: 'calc+arraydraw', | ||
| description: 'Sets the width (in px or fraction) of the legend for this shape.', | ||
| }), | ||
|
|
||
| type: { | ||
| valType: 'enumerated', | ||
| values: ['circle', 'rect', 'path', 'line'], | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.