Skip to content

fix for null scales #759

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 1 commit into from
Feb 17, 2022
Merged

fix for null scales #759

merged 1 commit into from
Feb 17, 2022

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.

2 participants