score:1
Accepted answer
Create a g
element for the y-axis outside the update function.
In the update
g_y_axis.call(yaxis);
Why do you have all that code duplication inside the update function?
Put it all in a function and call it with a selection to update the selection.
Source: stackoverflow.com
Related Query
- D3 - Update Pattern and y axis
- How do I implement d3's enter update exit pattern for an area chart with focus and context?
- d3 change and update axis domain scatterplot
- Transition both circles and text (within g element) in single general update pattern
- Struggling with D3 general update pattern and groups
- d3.js - update axis and change width of path
- d3 transition: update axis and data just once
- d3.js unable to use general update pattern and transition
- How to update axis using d3.js
- d3 update data and update graph
- How can I get the D3.js axis ticks and positions as an array?
- D3: Is it possible to zoom+pan one axis and only pan the other?
- d3.js & nvd3.js axis and label precision formatting
- how to set the domain and scale on an axis on a nvd3.js multiBarChart
- nvd3.js-Line Chart with View Finder: rotate axis labels and show line values when mouse over
- D3 Y Axis Scaling and Path Transition
- Ticks only at the start and end of an axis
- D3 update dataset on click and redraw the bar chart
- D3 (v4): update pattern multiple elements in group
- Reusable charts in d3: how do the create and update selections work?
- d3 axis label cut off in chrome and firefox
- d3.js - v3 and v4 - Enter and Update differences
- Data points and ticks in the scaleBand axis are not aligned
- d3 bar chart y axis ticks and grid lines above max value
- d3js axis dates start and end value only
- D3 V4 Transition on entering elements using General Update Pattern with merge
- Append Value to Rickshaw Graph Axis and what is ticksTreatment and Preserve
- c3 graph in a dark background; how to change axis and tick value color
- Title and Axis labels
- Formating minutes and seconds on a D3 axis
More Query from same tag
- D3 text positioning inside g element
- Positioning externally loaded svg in D3
- how to display dates in selected month and year dc.js
- D3.js > binding data in nested html structure
- D3 force directed uncaught type error
- How to change the transition for angularjs-nvd3-directives charts
- Error - Zoom in D3 map - d3.behavior is undefined
- Loading in a CSV file as a Map (D3 and JavaScript)
- Dual Y axis line chart in dc.js
- How to use d3 with bootstrap
- Basic JSON Formatting for C3.js when data loaded via URL using Rails
- sorting d3js bar chart
- Add a Circle for Every nth Data Element d3.js
- How to export/save updated d3.js v4 tree json data string
- How can I add zooming to the d3 collapsible tree example?
- d3.js projection scale doesn't increase a size of a country
- Django translations - translate days of week
- I can't update/animate my d3v5 scatterplot with transitions
- D3(v5) collapsable tree with search
- Show yearly X labels for June instead of January on d3.js chart
- How can I customise event listeners in d3.js?
- How to visualize JSON data as tree diagrams using D3.js?
- How to control the group node distance in Hierarchical Edge Bundling in D3.js
- d3 edges overlap node
- With D3, how can I set attribute ("fill", "none") of axis path and line, but not text (without editing stylesheet)
- Extending paths in D3 with transition
- How to change the tick value in d3, javascript from "1900" to "January"?
- dc-js line chart showing extra filled line at average change
- Missing links in force directed graph
- Simple bar chart in d3.js