score:2
Accepted answer
The synchronization issue comes from the fact that you are using a transition to move the circles and not using a transition to update the x-axis. Here's the relevant snippet from the draw
function:
circles.transition()
.attr("cx", function(d) { return x(dateFn(d)) })
.attr("cy", function(d) { return yValueFn(d) });
svg.selectAll("g.x.axis").call(xAxis);
Because D3 has a default transition duration of 250 milliseconds, the circles are lagging behind the axis, which is updated instantly. You can synchronize the two by reducing the transition duration to 0 like this:
circles.transition().duration(0)
That should make the x-axis and circles move synchronously.
Source: stackoverflow.com
Related Query
- D3.js - Data and Axis Not Synchronized During Pan
- Data points and ticks in the scaleBand axis are not aligned
- D3 zoom only affect in axis and not in data
- Why animated d3 svg line is not synchronized with the axis shift in IE9 but synchronized in IE11 and Chrome?
- D3: Is it possible to zoom+pan one axis and only pan the other?
- D3: "SVG4601: SVG Path data has incorrect format and could not be completely parsed."
- The mouse over event is not fired during the drag and drop action in d3.js
- With D3, how can I set attribute ("fill", "none") of axis path and line, but not text (without editing stylesheet)
- d3 multiline update path and transition path does not work with nested data
- Visualization data inserted in the webpage is not properly indented and not appearing at desired position
- d3 line and area charts not updating with new data array
- d3.js : attribute setting not working after binding data and entering elements
- D3.js bar chart - axis and labels not working / transitioning
- D3 forced layout zoom and pan not working
- d3.js : re-inserting elements during dragstart/mousedown interferes with click events in Chrome and Safari but not Firefox
- Line and Rect intersection not calculated properly on one axis
- Load and display data with condition, but the condition is not met
- D3.js y- axis ticks and grid lines do not align
- Apply zoom pan and axis rescale in d3
- D3 line chart does not show tool tip and data points properly
- Set axis range based on data set minimum and maximum in d3.js
- d3 v4: Clip path not updating after pan and zoom
- D3 axis ticks and grid lines do not align
- Javascript / D3.js - draw large data set - improve the speed of zoom and pan in svg chart ploted by d3.js
- Why are my D3.js circles not being created and removed as live data is generated?
- Multiple series in dimple.js with user selecting data for y1 and y2 axis
- Zoom axis works but stem lines and circle not work
- How to normalize data in d3 and plot the lines in the axis independent of other line ranges
- d3.js Why are axis and data slightly offset?
- How to show the unhighlighted/ not selected data points on scatter plots when using brush/group in dc.js? And is multiple brushes possible in dc.js
More Query from same tag
- Add a space between the axis and text with NVD3 charts
- Javascript or D3js Notation
- Differentiating between bars in tooltip for stacked bar chart
- d3 custom date format
- how can I turn strings into numbers in d3js
- Sunburst partition data overwritten by second sunburst on same page
- d3.js horizontal bar graph with positive and negative values - move y axis labels to far left side of graph
- Add labels to nodes in Hobbelt's "Group/Bundle Nodes" D3 force layout example?
- What option controls the linewithFocusChart focus area (Angular-nvD3)?
- D3.js: draw simple line graph starting from data arrays
- How do projects like d3 get all of their source into one large javascript file?
- How does datamaps display images instead of bubbles?
- Using arrays to calculate distance between co ordinates and set Y axis and scale - D3.js
- d3js zooming in one direction, panning in both directions
- How to show similar data on two y-axis in c3 chart
- Is there a trivial way to get non-strict JavaScript codebase to behave in a 'strict' environment?
- The XY coordinates in a d3 drag event are inverting
- Restrict Panning of d3.js chart to One Direction
- line missing from downloaded image of d3 scatter plot
- In d3.js v4 zoom functionality I am having an issue where when i zoom out and then pan the chart goes out of the viewport instantly
- Clip path is moving with group of elements when using d3.drag
- Collapsible Tree Layout. Spread the branches evenly
- d3.quantile seems to be calculating Q1 incorrectly
- D3JS: chart resizes when scrolling and down
- Circle packing with static size
- D3 code linking to php file outputs the actual code as text on the web page
- What does .data(function(d) { return d; }) return in d3?
- How to display interactively percentages in d3?
- how to frame data in a Matrixreport for nvd3 line plus Barchart using salesforce analaytics api
- d3.select by namespaced attribute