Skip to content

Conversation

@mbostock
Copy link
Member

#756 changed the test used to determine whether or not a scale exists. This updates Plot.legend to match. Now Plot.legend({color: {}}) throws an error because it does not consider the color scale to be defined (there is neither a type nor a domain). Supersedes #757.

@mbostock mbostock requested a review from Fil February 15, 2022 21:45
@mbostock mbostock force-pushed the mbostock/null-legend branch from 3899a74 to 7c67b8b Compare February 15, 2022 21:47
Copy link
Contributor

@Fil Fil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still crashes with Plot.plot({color: {legend: true}}) :)

Suggestion:

if (o && o.legend) {

-    if (o && o.legend) {
+    if (isScaleOptions(o) && o.legend) {

@mbostock
Copy link
Member Author

mbostock commented Feb 17, 2022

if (isScaleOptions(o) && o.legend) will break a number of tests, such as decathalon. 🤔

Checking key in scales will do it, though.

@mbostock mbostock force-pushed the mbostock/null-legend branch from 7c67b8b to 203d459 Compare February 17, 2022 18:52
@mbostock mbostock requested a review from Fil February 17, 2022 18:52
@mbostock mbostock merged commit 36a873c into main Feb 17, 2022
@mbostock mbostock deleted the mbostock/null-legend branch February 17, 2022 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants