Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numeric values not displayed in sankey network tooltip #147

Closed
NaveenMathewEvive opened this issue Sep 4, 2016 · 0 comments · Fixed by #217
Closed

Numeric values not displayed in sankey network tooltip #147

NaveenMathewEvive opened this issue Sep 4, 2016 · 0 comments · Fixed by #217

Comments

@NaveenMathewEvive
Copy link

NaveenMathewEvive commented Sep 4, 2016

In the following code Energy is a data frame with 'value' column of type numeric:

URL <- paste0(
        "https://cdn.rawgit.com/christophergandrud/networkD3/",
        "master/JSONdata/energy.json")
Energy <- jsonlite::fromJSON(URL)
sankeyNetwork(Links = Energy$links, Nodes = Energy$nodes, Source = "source",
             Target = "target", Value = "value", NodeID = "name",
             units = "TWh", fontSize = 12, nodeWidth = 30)
Energy$links$value <- as.character(Energy$links$value)
sankeyNetwork(Links = Energy$links, Nodes = Energy$nodes, Source = "source",
             Target = "target", Value = "value", NodeID = "name",
             units = "TWh", fontSize = 12, nodeWidth = 30)

However the tooltip rounds the digit down to integer. This is especially non-informative when values are of 0.abc form, which will be shown as 0.

Chris's suggestion of converting value to character did not work.

fbreitwieser added a commit to fbreitwieser/d3-sankey that referenced this issue Oct 19, 2016
- has several modifications from networkD3 sankey.js
- included fixes and features from unmerged pull requests:
- d3/d3-plugins#124: Fix nodesByBreadth to have proper ordering
- - d3/d3-plugins#120: Added 'l-bezier' link type
- d3/d3-plugins#74: Sort sankey target links by descending slope
- d3#4: Add horizontal alignment option to Sankey layout
- added option numberFormat, default being ",.5g" (see , fixes
christophergandrud/networkD3#147)
- added option NodePosX, fixes christophergandrud/networkD3#108
- added option to force node ordering to be alphabetical along a path
(only works well with trees with one parent for each node, but might fix
christophergandrud/networkD3#153)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants