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

Interactivity chapter reorganization #54

Open
jtr13 opened this issue May 19, 2022 · 0 comments
Open

Interactivity chapter reorganization #54

jtr13 opened this issue May 19, 2022 · 0 comments

Comments

@jtr13
Copy link
Owner

jtr13 commented May 19, 2022

7.2 change graphic to a bunch of circles on the svg

7.2.1 d3.select("svg").selectAll("circle").on("click")
(explain: message is added if someone clicks on any circle point: we don't need any information about which circle or its attributes, data, etc.)

7.2.2 change an attribute
d3.select("svg").selectAll("circle").on("click") ...
.attr("fill", "blue");
clicking on a circle changes its attribute (you need to know which circle)

7.2.3 get information about the element that received an event
d3.select("svg").selectAll("circle")
use either cx or r -- should be something that is different for the different circles

7.2.4.
d3.select("svg").selectAll("circle").data([ single array of different values than current ones for radii]).on("click", function(event, d) {
d3.select(event.currentTarget).attr("r", d); ...

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

No branches or pull requests

1 participant