This has nothing to do with "moving the chart". Here is the problem.
When you do this:
var labels = svg.selectAll("text")
You're selecting text elements that already exist in your SVG. Because of that, your "enter" selection will have less elements compared to what it should contain.
The solution is simple: select something that doesn't exist:
var labels = svg.selectAll("foo")
Or, alternatively, move the blocks that append the axes' labels to the bottom of the code.
Here is your updated fiddle: https://jsfiddle.net/mp7LxsL4/
- D3 JS chart is cut off after adding labels for X and Y axis
- C3js horizontal bar chart labels cut off and sizing issue
- Long tick labels getting cut off in plotly.js chart
- nvd3.js-Line Chart with View Finder: rotate axis labels and show line values when mouse over
- d3 axis label cut off in chrome and firefox
- Y axis labels are cut off on D3 plot
- How to modify axis labels in d3 for a stacked bar chart when the axis labels are mapped as part of the scale's domain
- x axis labels overlapping for grouped category bar chart in d3
- D3.js bar chart - axis and labels not working / transitioning
- D3.js v7 - How to make Y axis labels always show on screen for a scrollable chart
- D3 Labels in pie chart being cut off
- Zoom left and right axis for dual scaled chart in d3
- adding word wrap for D3.js tree chart labels
- Adding tooltip and x axis, y axis title to D3.js chart
- Tick labels in d3.js scatter plot chart getting cut off in Firefox 13.0.1
- How to rotate the text labels for the x Axis of a nvd3.js line chart
- How to change color only for data grid or x and y axis in chart in D3.js
- Adding tooltip and focus guides for x and y2 axis on multi-axis linechart in d3
- D3 labels for horizontal bar chart are stacking over eachother and not in their correct positions
- Data graph labels cut off on c3.js chart
- D3 Horizontal stacked bar chart axis cut off
- Prevent clipping of bubbles centered near boundaries in a bubble chart with log scale axis and sqrt scale for bubble size?
- MultiBar chart with nvd3 / d3 only shows labels for every other tick on the x-axis. How can I get them all to show up?
- How to do wordwrap for chart labels using d3.js
- D3 line chart axis text labels in multi line
- how to create labels for data in donut chart using d3.js
- inline style stroke-width for axis makes bold tick labels
- Special donut chart with different rings/arcs for positive and negative values
- d3 bar chart y axis ticks and grid lines above max value
- d3 gauge chart with labels and percentages?
More Query from same tag
- tips for animating d3.js shape
- How to remove tooltips on line when click button d3.js
- How to add labels for regions in c3.js line chart or detail chart?
- Where am I doing wrong!! D3-CSV
- I unable show the x-axis year and month using d3.js
- Unable to merge selections
- Ordinal scale does not color in properly despite unknown being implied?
- How to make d3 div tooltip scrollable?
- nodes without edges escaping the graph in D3 v4
- US Zipcode TOPOJson for D3
- Leaflet.js: Pass feature property to class constructor
- D3 transition line happening twice
- Reference Error JS not defined for Datamap
- What is the correct way to select leaf nodes in D3 partition layout example and apply different fill color?
- How to draw circles in each of the rectangles end point
- d3.js in drupal 7
- Rendering order in d3.js
- Add topojson on top of google map
- D3 Dot Matrix Chart
- Problem to show dynamic text on mouseover in D3.js and json file?
- Creating a swim lane chart using d3
- How to draw a rectangle in D3.js with only 2 coordinates
- How to wrap only one word in axis labels
- D3 add hover features to floorplan layer
- Drawing multiple bars per date
- Is there a way to make Internet Explorer understand this.style.setProperty?
- D3 Pie chart not updating correctly
- Using d3.js + SoundCloud API - Need to show track titles
- D3js: How to design topographic maps?
- Making a D3 Pie v4 Example - Animate On initial render