score:1
Accepted answer
in your code translate function x and y values are hard coded that is why it is causing the issue
edit:1
var labels = svg
.selectall("mylabels")
.data(data.nodes)
.enter()
.append("text")
.attr("x", function(d){ return(0)})
.attr("y", 0)
.text(function(d){ return(d.name)})
.attr("transform", function(d){ console.log(d); return( "translate(" + (x(d.name)) + ", " + (height-15) + ") rotate(-45)")})
.style("text-anchor", "middle")
above changes will work
Source: stackoverflow.com
Related Query
- How to rotate all text by x degree on x-axis in Javascript
- D3 grouped bar chart: How to rotate the text of x axis ticks?
- How to rotate the text labels for the x Axis of a nvd3.js line chart
- rotate x axis text in d3
- how to assign unique id to SVG text element in d3 javascript
- Hide all text on y axis dc.js bar chart
- How to rotate x-axis text in dimple.js?
- How to properly rotate text labels in a D3 sunburst diagram
- With D3, how can I set attribute ("fill", "none") of axis path and line, but not text (without editing stylesheet)
- How to correctly centre text element on all bars of a nvd3 bar chart
- How to add all but a few columns using javascript and d3
- D3.js How to rotate Text on a path
- How to rotate a group of text elements
- How can I rotate my text labels so they can't go upside-down (SVG)?
- How to transition D3 axis without tick text attribute reset?
- How to rotate and change font size on x axis
- Rotate x axis text on Horizontal bar chart
- How to rotate text around its centroid (vertically flip) in SVG / D3?
- How do I make my text keep the variable number and not the reference in javascript D3?
- How to get the same text of each elements in heat map as the y axis label?
- How to rotate text labels in a D3 x-axis?
- dc.js heatmap how to rotate text ?
- how to find all leaves of group with javascript and json
- How to display javascript variable as text using D3
- How to color the text labels individually on an axis in d3?
- Rotate text on half of custom circular axis
- d3 waterfall graph rotate in x axis values 180 to -90 degree
- How to place all focus appended text at a same, fixed position in d3.js?
- How to Remove all the click handlers in javascript
- How do projects like d3 get all of their source into one large javascript file?
More Query from same tag
- D3.js selection.data() optional parameters
- draw a line from one circle to another in d3.js
- d3 charts sankey json error
- How to integrate graphviz in angular
- Add circle to pack layout
- Only last Y-axis is being updated while dragging on d3 chart
- Modifying MongoDB data in flask
- Multidonut chart d3 legendds not working
- making circle clickable in svg
- mouseover on d3 force layout bubbles not working
- jQuery parallel d3 objects
- D3 - How to update hidden branches in tree layout
- d3.js Overlay Graph
- How can I split an ordinal axis in d3?
- How to set circle at the right end of the last bar / item using D3
- Random horizontal line showing in d3 line chart?
- Would like to use length (from d3.nest) as radius
- SVG doesn't render on screen, console log shows "false" suggesting promise was rejected
- How can I handle data filtering on a button click on D3.js?
- d3 stacked to grouped bar chart date axis
- D3 Chord Diagram Google Chrome
- Embedded Google Map with d3.js overlay shows UI options and overlay element but NOT the map itself
- How can I color one Y-axis line different from the other grid-lines?
- Drawing multiple links between fixed nodes
- Filter dataset for path element in D3js (v3)
- There are duplicate viewreset events when loading different path features in Leaflet with D3.js
- How can I add labels to a pie chart, when using an array without named entries
- Colored text and line-breaks for D3 node labels
- Error while rendering D3 pie chart (not displaying properly)
- Difference between d3.js and d3.v3.js