-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Contour legend #2891
Contour legend #2891
Changes from 1 commit
44aa70e
597a845
7f0db7c
0f532f3
7843d83
e25b9ff
73f279b
74e7f84
1d05081
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 |
---|---|---|
|
@@ -173,7 +173,13 @@ module.exports = { | |
valType: 'boolean', | ||
role: 'info', | ||
editType: 'legend', | ||
description: 'Determines whether or not a legend is drawn.' | ||
description: [ | ||
'Determines whether or not a legend is drawn.', | ||
'Default is `true` if there is a trace to show and any of these:', | ||
'a) Two or more traces would by default be shown in the legend.', | ||
'b) One pie trace is shown in the legend.', | ||
'c) One trace is explicitly given with `showlegend: true`.' | ||
].join(' ') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for 📚 |
||
}, | ||
colorway: { | ||
valType: 'colorlist', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1144,9 +1144,13 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac | |
coerce('ids'); | ||
|
||
if(Registry.traceIs(traceOut, 'showLegend')) { | ||
traceOut._dfltShowLegend = true; | ||
coerce('showlegend'); | ||
coerce('legendgroup'); | ||
} | ||
else { | ||
traceOut._dfltShowLegend = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #749 🙄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the record: I added There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, that's what I expected. I don't think there's a nicer way to do this than what you coded in this commit 👌 |
||
} | ||
|
||
Registry.getComponentMethod( | ||
'fx', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, | |
// plots/plots always coerces showlegend to true, but in this case | ||
// we default to false and (by default) show a colorbar instead | ||
if(traceIn.showlegend !== true) traceOut.showlegend = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
traceOut._dfltShowLegend = false; | ||
|
||
colorscaleDefaults( | ||
traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -567,7 +567,6 @@ | |
}, | ||
"height": 450, | ||
"width": 1100, | ||
"autosize": true, | ||
"showlegend": false | ||
"autosize": true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -341,8 +341,7 @@ | |
"line": { | ||
"color": "black" | ||
}, | ||
"type": "scatter", | ||
"showlegend": false | ||
"type": "scatter" | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was used in
getLegendData
and inlegendDefaults
, but even before one of them overrode half the logic, and now that logic has diverged further, so it didn't make sense to pull it out.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 🔪 job here