There are actually a couple of things happening here - as you pointed out, the data outside of your new data range is not being removed, but also, new data that is outside of the existing data range is not being added. This all has to do with what selection you are modifying in your code - your update function should be using the
exit() selections to handle these - see Thinking with Joins.
Here is an updated fiddle: http://jsfiddle.net/LPtTm/11/
- Updating D3 column chart with different values and different data sizes
- Special donut chart with different rings/arcs for positive and negative values
- Updating data values with HTML input and changing the data array
- D3 animate donut chart while updating it with different data length
- Updating a pie chart with a new data set with more values
- nvd3.js-Line Chart with View Finder: rotate axis labels and show line values when mouse over
- d3.js stacked bar chart with positive and negative values
- d3.js moving average with previous and next data values
- how to zoom d3.js chart and reload data with greater granularity (in AJAX)
- Align lines and dots with x-axis values in line chart
- Grouped bar chart with zoom and updateable data error
- Specifying Ticks on D3 Bar chart with Time Series data and scaleBand
- d3 line and area charts not updating with new data array
- Updating a bar chart with .update, .enter, and .exit?
- D3 bar chart not working properly with all negative and positive values
- Simple D3.js line chart with data that are values collect every hours
- Transition for grouped bar chart in d3 when updating the data values
- d3.js: data binding with table and chart
- How do you get JSON data and create a line chart with d3.js?
- Time in x-axis and data for the y-axis for line chart in d3.js doesn't match/show with what (data) is on JSON
- Generating a simple bar chart with d3.js and an array of form data
- How do I plot data on different x-axes and scales with d3.js? And keep it linked for brushes/tooltips?
- d3 bar chart labels not getting updated on updating the chart with the new data
- Show values on Y Axis as it is with Higher and lower limits NVD3 Line Chart
- d3.js. Stream chart shifts with different data sets. Why?
- D3.JS how to load 3 csv files and change data on line chart with button click event?
- How to create a line chart with vertical line and different backgrounds?
- Updating d3 bar chart labels with new data of variable length
- D3 - Chart with positive and negative values
- dc.js Stacked Bar Chart having only one column and with elastic X Axis is not rendered properly
More Query from same tag
- Multiple series in dimple.js with user selecting data for y1 and y2 axis
- d3: Path data generator and if-statement
- d3.js line chart with two arrays
- D3 graphs Multi series with different time range not working properly
- d3js stacked bar chart with groups
- d3.js data array if statement
- How to get translate property from a group?
- D3 Translate Value
- d3.js v4 zoom via mouse wheel and programmatically
- D3.js - How to change position of labels on zoom
- In D3.js how do I rotate SVG's in a continous circular fashion
- d3 transitioning from bar to pie and back
- Marimekko Chart: x axis ticks with irregular column width
- How does d3.js tell the difference between X-axis and Y-Axis?
- conditionally fill area between two lines in d3
- How to render svg in backend and save to local using in node js using d3?
- Histogram with values from csv
- Drupal D3 module documentation
- Counting the number of continuous blue bars till the hover bar
- use d3 to create neo4j node tooltip
- Introduce gap in path in d3
- D3.js path goes in different directions in V3 vs V4
- d3js - my line graph not working, and throws error
- D3/SVG. How do I position a child svg element beyond its parent's extent?
- d3js does not enter into line function
- Can dc.js render a bar chart without dimension?
- dc.js : how to change circle color on mouseover
- d3.js tree - Set depth for specified child nodes?