Comments (3)
Without seeing your raw data, it could be that any element that has children should NOT have a size property. If parent elements have a size property, their node size will calculate incorrectly. It would be great if the sunburst could automatically discard a "size" property if a node has children.
I used this code to disregard the size attribute if a node has children.
Sunburst()
.data(data3)
.size(function(d) {
if (d.children) {
return null;
} else {
return d.size;
}
})
from sunburst-chart.
So how would I go at it, if I wanted to divide my four root-segments into four equal parts?
from sunburst-chart.
I suppose it would be even better if the size attribute was directly calculated against its parent irregardless of child nodes, but it seems that this tool does it the other way. So the issue request here should go something like this:
Describe the bug:
Node sizes don't calculate in ways that support a hierarchical visualization.
To reproduce:
Create a JSON file where all nodes have size attributes, choose an element that has children and give it a large size value. The children will not cover the parent node - there will be gaps in the visualization. The following workaround code is used to prevent this behavior:
Sunburst()
.data(data3)
.size(function(d) {
if (d.children) {
return null;
} else {
return d.size;
}
})
Hoped for behavior:
Root node should (obviously) always be 100%, each child element from there down should use the size attribute to calculate against its parent node. If no size is given then each element should be spread equally (if there are two children they are each 50%, 4 would get 25%, etc.) across its parent node. If a child element has children with sizes that don't calculate to 100%, then the children should be automatically spread proportionately to get to 100% of the parent.
I can't foresee a use case where a parent element should be larger than the combined size value of the children.
from sunburst-chart.
Related Issues (20)
- Chart getting duplicated for every useEffect call in react app HOT 7
- M.svg.transition is not a function HOT 1
- Tooltips sometimes appear invisible when using browser zoom HOT 2
- Image or text in centre of chart
- focusOnNode is not a function HOT 3
- Labels not showing though it fits both angular or radial HOT 5
- Optionally truncate labels instead of hiding them entirely HOT 2
- Add Feature to Onclick HOT 3
- Tooltip is not showing HOT 5
- Event on click outer ring segment HOT 3
- Chart based on month, date, hour and minutes. HOT 2
- Posibility of change label style HOT 1
- Not able to change style in Angular.
- Hide node are not working properly HOT 2
- How to add custom behaviour on click event of any slice of sunburst component in react? HOT 4
- Styling colors
- How to stop onClick from overriding the default focusOnNode method? HOT 3
- Argument of type '(d: any, parent: any) => any' is not assignable to parameter of type 'Accessor<Node, string>'.
- Export svg
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sunburst-chart.