8000 add options to include shapes and `newshape` in legends by archmoj · Pull Request #6653 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 30 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6545353
register legends after shapes
archmoj Jun 27, 2023
786d9e6
add options to include shapes in legends
archmoj Jun 27, 2023
2d7d3da
test clicking shape legends
archmoj Jun 28, 2023
332a0dd
draftlog
archmoj Jun 28, 2023
8a0f60a
improve descriptions
archmoj Jun 28, 2023
f0c6b72
add comments to core.js about order of registering components
archmoj Jun 29, 2023
d3004c1
use hexagon2 for path symbols
archmoj Jun 29, 2023
51a28f9
use overrideAll in newshape and fix bundling issue
archmoj Jun 29, 2023
0fa6914
Merge branch 'master' into shape-legends
archmoj Jun 30, 2023
4728e86
Merge remote-tracking branch 'origin/master' into shape-legends
archmoj Jul 4, 2023
2f1f812
Merge remote-tracking branch 'origin/master' into shape-legends
archmoj Jul 5, 2023
3511eb4
test showing shapes in groups
archmoj Jul 5, 2023
8e181cc
rename vars to point to data updates
archmoj Jul 6, 2023
6c0ab2e
handle shape legends group click
archmoj Jul 6, 2023
7870720
avoid unrecognized messages on click
archmoj Jul 7, 2023
ef0fe6f
add grouptitle and handle click
archmoj Jul 7, 2023
2e77fc7
test legendrank
archmoj Jul 7, 2023
58b1cb1
mention traces and shapes order in legendrank description
archmoj Jul 7, 2023
3168078 8000
test shape legends and groups in multiple legends
archmoj Jul 7, 2023
6343338
add name to newshape and improve descriptions
archmoj Jul 17, 2023
7bf5029
coerce newshape.name
archmoj Jul 17, 2023
948fd02
add name to newshapes when creating a new one
archmoj Jul 18, 2023
e5a600d
Update src/components/shapes/draw_newshape/attributes.js
archmoj Jul 18, 2023
5b02b62
more name appears fixes and update the schema
archmoj Jul 18, 2023
b35add8
fix shape.name updates via editing legends
archmoj Jul 18, 2023
6111aba
fix double click shape legends
archmoj Jul 19, 2023
5c0168c
simplify handling shape legends in click
archmoj Jul 20, 2023
15986b8
jasmine tests for editable shape legends
archmoj Jul 21, 2023
759dbb4
use update instead of restyle & relayout when updating shape legends
archmoj Jul 24, 2023
9123425
Merge remote-tracking branch 'origin/master' into shape-legends
archmoj Jul 25, 2023
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
Prev Previous commit
Next Next commit
test showing shapes in groups
  • Loading branch information
archmoj committed Jul 6, 2023
commit 3511eb4f07c604384aba19d4f0a0c992bb41a5e0
4 changes: 3 additions & 1 deletion src/components/legend/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ function groupDefaults(legendId, layoutIn, layoutOut, fullData) {
var legendReallyHasATrace = false;
var defaultOrder = 'normal';

var allLegendItems = fullData.filter(function(d) {
var shapes = (layoutOut.shapes || []).filter(function(d) { return d.showlegend; });

var allLegendItems = fullData.concat(shapes).filter(function(d) {
return legendId === (d.legend || 'legend');
});

Expand Down
Binary file modified test/image/baselines/text_on_shapes_basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 32 additions & 8 deletions test/image/mocks/text_on_shapes_basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,38 @@
"margin": {"l":20,"r":20,"pad":0},
"showlegend": true,
"shapes":[
{"showlegend": true, "label":{"text":"angle zero", "textangle":0, "textposition": "end", "padding": 20},"xref":"paper","yref":"paper","x0":0.6,"x1":0.8,"y0":0.3,"y1":0.6, "type": "line"},
{"showlegend": true, "label":{"text":"top right, xanchor right, <br>angle 45", "xanchor":"right", "textangle":45, "textposition": "top right", "padding": 20}, "layer":"below","xref":"paper","yref":"paper","x0":0.5,"x1":0.6,"y0":0.4,"y1":0.6},
{"showlegend": true, "label":{"text":"top right", "textposition": "top right"}, "xref":"paper","yref":"paper","type":"circle","x0":0.3,"x1":0.35,"y0":0.2,"y1":0.4},
{"showlegend": true, "label":{"text":"xanchor right, position not set<br> two lines", "xanchor":"right", "padding": 10, "font": {"family":"Courier New, monospace", "size":20}}, "xref":"paper","yref":"paper","type":"line","x0":0.8,"x1":0.9,"y0":0.8,"y1":0.9},
{"showlegend": true, "label":{"text":"position auto, xanchor center, angle -30", "xanchor":"center", "textangle":-30}, "layer":"below","x0":2,"x1":3,"y0":7,"y1":9.5,"opacity":0.5,"fillcolor":"#05e","line":{"width":3,"color":"#025","dash":"dashdot"}},
{"showlegend": true, "label":{"text":"position auto, yanchor top", "yanchor": "top"}, "yref":"paper","type":"line","x0":1.1,"x1":2.4,"y0":0.1,"y1":0.4,"line":{"color":"#039","dash":"dot","width":2}},
{"showlegend": true, "label":{"text":"position auto, xanchor center", "xanchor":"center"}, "xref":"paper","x0":0.8,"x1":0.9,"y0":1,"y1":3,"fillcolor":"#ccc"},
{"showlegend": true, "label":{"text":"position end", "textposition": "end"}, "yref":"paper","type":"line","x0":4.1,"x1":6.4,"y0":0.2,"y1":0.0,"line":{"color":"#339","width":3}}
{
"showlegend": true,
"label":{"text":"angle zero", "textangle":0, "textposition": "end", "padding": 20},"xref":"paper","yref":"paper","x0":0.6,"x1":0.8,"y0":0.3,"y1":0.6, "type": "line"
},
{
"showlegend": true,
"label":{"text":"top right, xanchor right, <br>angle 45", "xanchor":"right", "textangle":45, "textposition": "top right", "padding": 20}, "layer":"below","xref":"paper","yref":"paper","x0":0.5,"x1":0.6,"y0":0.4,"y1":0.6
},
{
"showlegend": true,
"label":{"text":"top right", "textposition": "top right"}, "xref":"paper","yref":"paper","type" 7CBC :"circle","x0":0.3,"x1":0.35,"y0":0.2,"y1":0.4
},
{
"showlegend": true, "legendgroup":"g1",
"label":{"text":"xanchor right, position not set<br> two lines", "xanchor":"right", "padding": 10, "font": {"family":"Courier New, monospace", "size":20}}, "xref":"paper","yref":"paper","type":"line","x0":0.8,"x1":0.9,"y0":0.8,"y1":0.9
},
{
"showlegend": true, "legendgroup":"g1",
"label":{"text":"position auto, xanchor center, angle -30", "xanchor":"center", "textangle":-30}, "layer":"below","x0":2,"x1":3,"y0":7,"y1":9.5,"opacity":0.5,"fillcolor":"#05e","line":{"width":3,"color":"#025","dash":"dashdot"}
},
{
"showlegend": true, "legendgroup":"g2",
"label":{"text":"position auto, yanchor top", "yanchor": "top"}, "yref":"paper","type":"line","x0":1.1,"x1":2.4,"y0":0.1,"y1":0.4,"line":{"color":"#039","dash":"dot","width":2}
},
{
"showlegend": true, "legendgroup":"g2",
"label":{"text":"position auto, xanchor center", "xanchor":"center"}, "xref":"paper","x0":0.8,"x1":0.9,"y0":1,"y1":3,"fillcolor":"#ccc"
},
{
"showlegend": true, "legendgroup":"g2",
"label":{"text":"position end", "textposition": "end"}, "yref":"paper","type":"line","x0":4.1,"x1":6.4,"y0":0.2,"y1":0.0,"line":{"color":"#339","width":3}
}
],
"newshape": {
"line": {
Expand Down
0