score:2
Accepted answer
You could add JavaScript to the HTMLWidgets to change certain text attributes/styles...
library(networkD3)
library(htmlwidgets)
links <- data.frame(
src = c(0, 0, 0, 1, 1, 1, 2, 2, 2),
target = c(3, 4, 5, 3, 4, 5, 3, 4, 5),
value = 1
)
nodes <- data.frame(name = paste0("node", 1:6))
sn <- sankeyNetwork(
Links = links,
Nodes = nodes,
Source = 'src',
Target = 'target',
Value = 'value',
NodeID = 'name',
fontSize = 16,
width = 600,
height = 300,
margin = list("left" = 100)
)
sn <- onRender(
sn,
'
function(el,x) {
d3.select(el)
.selectAll(".node text")
.attr("text-anchor", "middle")
.style("writing-mode", "vertical-rl")
.style("text-orientation", "upright");
}
'
)
sn
Source: stackoverflow.com
Related Query
- Can I rotate the node labels in a Sankey Plot (networkD3::sankeyNetwork)?
- NetworkD3 Sankey Plot in R: How to switch text labels from the right to the left of the inner nodes only
- 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 can I achieve the R kernel density estimate plot using D3.js?
- How can I connect two parent node into one child node and how to make a tooltip for each node in the tree pragmatically? in D3 js (SVG)
- How to assign the x-axis position of a node in a Sankey Diagram (D3) from the json file
- dimple.js How can I change the labels of a chart axis without changing the data?
- How can I add labels inside the points in a scatterplot?
- How can I add images in the nodes of a D3 Sankey diagram, using the rcv and networkD3 packages in R?
- D3.js rotate axis labels around the middle point
- How can I add axis labels to a sankey diagram in d3?
- Aster Plot legend labels along with the arc
- How can I rotate my text labels so they can't go upside-down (SVG)?
- How to place node title to the left or right of the node in d3 Sankey graph?
- How can I adjust the labels on a DC.js pie chart?
- How can I get the dom svg element from d3 node data?
- how to give different color for the lines in the Sankey plot to show different groups?
- c3.js : How to rotate the labels above the bar-chart bar items?
- Using d3, how can I create a histogram or bar plot where the last bar is the count of all values greater than some number?
- How can I plot the horizontal grid according the y-axis ticks in D3?
- Changing the colour of the node in Sankey Diagram using D3.js library.
- How to rotate the text labels for the x Axis of a nvd3.js line chart
- How to control node labels in Sankey diagram
- How to rotate X-axis labels onto the bar in bar chart?
- Pushing left labels to the left of the nodes in Sankey diagram
- How can i show the labels on the x axis when there is data overlap in d3js?
- D3.js Sankey Chart - How can I highlight the set of links coming from a node?
- Can the links in D3.js Sankey Diagrams be anything besides cubic bézier curves?
- How can I change the attribute of the circle node in d3.js?
- how can i hide the names of ancestors of a node
More Query from same tag
- reference to angular's function from d3 data enter
- limit number of tick marks in d3.js x axis with ordinal scale
- How do I change from JS Array to JS Object for D3 Chart
- Scale returning value larger than domain
- Set JS variable when clicking on polygon in Mapbox
- Issues in converting StackBar chart from D3.js version 3 to version 4
- Drawing parallels on map
- Appending to an existing svg file with D3
- D3.v3 Brush Strange Behavior
- SVG and D3.js Issue with correct rotation after translate
- Updating SVG Element Z-Index With D3
- SVG Marker Not Working
- Change a pivot point of the nested svg using d3.js
- returning band members from musicbrainz
- Render geoJSON with d3
- D3: Convert scale level of the time scale to time period, like: day, week or month?
- how to add y axis label(custom text) in rickshaw graph?
- How would I stack an SVG circle on top of another one using D3?
- d3 Pie chart with one object key /value
- d3.js - dragmove circle with v6 not work as expected
- Bringing data from PHP into D3.JS
- Dimple/D3 Pie chart with missing pieces
- Trying to use a module pattern to safely get data
- Make a fixed node in d3.js un-fixed
- d3.js / CoffeeScript: Access execution context (this) of both class and path in mouseover
- Uncaught TypeError: Cannot read property 'linear' of undefined
- d3: Multi-Series Line Chart with associative array
- D3.js Bilevel Partition - initial chart load zoomed on slice
- d3.js Strange dragging behaviour when using dynamic scaling
- Read a string in D3