Replies: 2 comments
-
|
problem is on {partition.descendants().map((node, i) => {
return (
<Group key={`node-${i}`}>
<path
fill={(d) => (d.children ? colorScale(d.data.name) : colorScale(d.parent.data.name))}
stroke="#fff"
strokeWidth={1}
display={(d) => (d.depth ? null : 'none')}
- d={<Arc key={`node-${i}`} innerRadius={node.y0} outerRadius={node.y1} startAngle={node.x0} endAngle={node.x1} data={node.value} />}
/>
</Group>
);
})}Another problem is while in d3 you can do something like .fill((d) => (d.children ? colorScale(d.data.name) : colorScale(d.parent.data.name)))this won't work in visx. instead you use the fill={node.children ? colorScale(node.data.name) : colorScale(node.parent.data.name))}Something like the below should work, but I haven't tested: {partition.descendants().map((node, i) => {
return (
<Arc
key={`node-${i}`}
innerRadius={node.y0}
outerRadius={node.y1}
startAngle={node.x0}
endAngle={node.x1}
fill={node.children ? colorScale(node.data.name) : colorScale(node.parent.data.name))}
stroke="#fff"
strokeWidth={1}
display={node.depth ? null : 'none')}
/>
);
})} |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I think this is a minimal fix with a few things that weren't clear from above. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to draw a sunburst pie chart (2, or more, concentric, donut charts, with each inner pie that encompasses each direct outer pie).
I tried to re-apply the logic used for @visx Treemap, its typescript definitions, together with this d3 tutorial how to draw a sunburst (https://gist.github.com/denjn5/e1cdbbe586ac31747b4a304f8f86efa5).
I came up with the following, but that does not work. What am I missing ?
If I refer to the Typescript definition of the Arc component, I should have something as follows in Arc (but that generates error messages) :
With @visx Treemap, the input data has the following format : (not sure how it applies to Partition component)
Beta Was this translation helpful? Give feedback.
All reactions