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

forceRadial x, y and angle accessors #167

Merged
merged 3 commits into from
Jul 28, 2020
Merged

forceRadial x, y and angle accessors #167

merged 3 commits into from
Jul 28, 2020

Conversation

Fil
Copy link
Member

@Fil Fil commented Jul 6, 2020

Includes #113 (by @GerardoFurtado), and fixes #152

demonstration https://observablehq.com/d/9187c989f882beee

PS: It's a breaking change since the force.x() returns an accessor function not a value.

GerardoFurtado and others added 3 commits July 6, 2020 18:17
Currently, the radial force...

    d3.forceRadial(radius[, x][, y])

... allows only numbers to the `x` and `y` positions:

> If x is specified, sets the x-coordinate of the circle center to the specified number and returns this force.

This proposed change allows passing functions to `radial.x()` and `radial.y()`, using the same pattern of other forces. Here is the working demo: https://bl.ocks.org/anonymous/0685343afe4675a022403be8728bc7c4/7dda06727201c128b9ff820b24c2c955e655436d
@Fil Fil added the feature label Jul 10, 2020
@Fil Fil mentioned this pull request Jul 27, 2020
5 tasks
@Fil Fil changed the base branch from master to d3v6 July 27, 2020 10:43
@Fil Fil merged commit 00b7bc4 into d3v6 Jul 28, 2020
@Fil Fil deleted the radial-angle-113-152 branch July 28, 2020 08:53
@Fil Fil mentioned this pull request Jul 28, 2020
4 tasks
@ms007
Copy link

ms007 commented Oct 13, 2020

I don't see that this feature got into d3 or am I wrong?
I would just need to set an angle...

@Fil
Copy link
Member Author

Fil commented Oct 13, 2020

Thanks for you interest. No the feature didn't make it into D3@6. I think it should be published it as a stand-alone plugin or module at some point, but I haven't had much time recently. The code is simple enough to copy/paste, maybe it just needs a good example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Suggestion: add an angle property to d3.forceRadial() to define the forces in this angle
3 participants