Skip to content
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

Remove data requirement from arc #892

Closed
wants to merge 1 commit into from

Conversation

oscar-broman
Copy link

arc from d3-shape does not take any arguments: https://github.com/d3/d3-shape/blob/master/src/arc.js#L87

Fixes #886

Copy link
Collaborator

@williaster williaster left a comment

Choose a reason for hiding this comment

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

From my comment in #886

I think data should be optional, not removed because it supports both types of usage.

arc optionally takes arguments as you can see in the readme and it's confusing but a few lines down from the line you linked you can see that arguments are passed along to the accessors.

Arc is functionally as it is used in the /chord demo. If you omit the data prop, it fails to draw anything. I think this is confusing because the d3 API supports two types of usage (and thus so does visx):

const arc1 = d3.arc();
arc1({ innerRadius, ... }); // "M0,-100A100,100,0,0,1,100,0L0,0Z"

const arc2 = d3.arc().innerRadius(...)...;
arc2(); // "M0,-100A100,100,0,0,1,100,0L0,0Z"

@@ -41,13 +38,12 @@ export default function Arc<Datum>({

// eslint-disable-next-line react/jsx-no-useless-fragment
if (children) return <>{children({ path })}</>;
if (!data) return null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

since data is already optional, I think this is probably the only line that needs to be removed since it is valid to call path without arguments.

@williaster
Copy link
Collaborator

This has been inactive for a while, closing in favor of #937

@williaster williaster closed this Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arc example
2 participants