I drew a bubble chart with d3 like the picture below. However, if the screen width value is reduced to less than 764px, the number of bubbles, the r (radius value) of the circle, and the distance value of each g tag (circle) should be adjusted.
Is there a way to adjust it to jquery or css?
![
What you're talking about is probably a situation where certain bubbles should not be seen at all on a screen below a certain width. But it doesn't seem like an issue that's going to be solved by giving a particular bubble display: none;
. (No? Please find out.))
If I were you, I would call a function whenever the window.resize
event occurs. What the function does is:
And call this function once when the window is loaded for the first time. This approach would certainly work. Try it! There's no right answer to programming.
+ If you want to respond to the entire bubble chart, you can just wrap it in a viewbox.I don't know if you asked me this.
© 2024 OneMinuteCode. All rights reserved.