score:7
The axes are working when you zoom. That's because, in the function zoomed()
you are updating the scales.
So in order to make the grids zoom, you just need to update its scales too. Put this code inside the function zoomed()
and it should work.
xGrid.call(
d3.axisBottom(x)
.scale(d3.event.transform.rescaleX(x))
.ticks(5)
.tickSize(-height)
.tickFormat("")
)
Now you just need to replicate this scale update to all other grids. Sorry that I couldn't give you a complete answer, but I don't have much time right now.
Now, in my opinion, you should not have the function make_gridlines()
because it is really simple, and when you're working on lots of updates on different places it confuses me.
So, instead of calling make_gridlines()
you call d3.axisBottom(x).ticks(5)
.
(Note that I'm new to d3 and js, so I'm recommending this based on my little experience and knowledge)
Source: stackoverflow.com
Related Query
- Scale / Redraw d3.js gridlines on zoom / drag
- D3js: How do I clear the zoom scale set by the d3.zoom event?
- nvd3.js chart ajax data redraw - missing hovereffect + former yAxis scale
- D3 - How to get correct scale and translate origin after manual zoom and pan to country path
- How to use mouse click and drag to zoom in D3
- D3 Zoom with Scrollbars used as panning, Scrollbar width and height adjusts to zoom scale
- d3.js: Drag is disabled when use zoom with force layout
- D3 zoom event firing on drag in Angular
- How to limit the zoom of a time scale in d3.js to the minute?
- D3 Collapsible Tree only drag without zoom and jump and scroll
- d3 combine zoom and drag calls?
- Zoom event overrides Drag behavior in d3js
- D3 V6 - Zoom and Drag Functionality
- d3 update old scale when pan and zoom
- D3.js zoom with Ordinal axis not working - Issue with setup of scale in zoom behavior?
- Matching leaflet zoom level with d3 geo scale
- Map zoom and pan in d3 js v4 + scale limit
- d3: zoom on double y scale broken
- d3js zoom + drag causes conflict
- d3 zoom and drag with SVG axes and canvas chart
- Pan, zoom canvas together with drag nodes in D3
- D3.js scale initial zoom level
- D3 behave weird when I do a drag act which also trigger unexpected zoom function
- Allow zoom with buttons only, allow pan with mouse drag
- What Transformation values to calculate for scale and translate if you want to zoom
- D3 Initial Zoom with default mercator projection scale
- How to redraw data after d3.js zoom
- Get d3 v4 zoom and drag working together - simple example
- Force + Drag + Zoom : freeze after few seconds
- Setting ticks on a time scale during zoom
More Query from same tag
- D3.js how to get multiple scales for data array?
- How to create a d3 radial-tree from a list of nodes and links?
- How to get value from the element using selection in d3
- Staggered transition in multi line graph
- d3 show number instead of percentages on pie chart
- Why is the first Link item being skipped?
- ReferenceError- crossfilter is not defined
- Ticks on Axis not appearing
- Fix categories in categoriaxis in dimple js
- create javascript object (with key pairs) from json (not in correct key pair)
- Apply d3 geo projection to an image
- Selecting SVG with D3
- How to scale SVG elements separately.
- nvd3 line chart - set the color of the line by Y value
- How to make curve links and add tooltip on links at the same time?
- Switching from require to import for d3 v4 modules
- D3.js Auto font-sizing based on nodes individual radius/diameter
- Javscript Plotly error: 'calling plotly as if redrawing but this container doesn't have a plot yet"
- Sankey Data formatting, presentation
- D3 update line graph
- Why isn't my map function returning all the csv file rows in d3 js?
- Mouseover d3.js map with different layers
- How to draw Circles in an Arc?
- lat/lon positon on a D3.js map
- Wrapping up a div and anchor tag from given data
- draw arc from 0 to 360 degrees with d3.js
- trying to rotate a globe in d3, centering on a particular country
- How to Give the link to button that contains to specific circle
- how to get d3.event.Y as location in a <g> element
- Can't get d3 donut chart labels to line up correctly