Clive
Clive

Reputation: 435

How can I have multiple fills within the same d3 arc

I'm trying to do something like this:

enter image description here

In d3.js. I can draw the donut chart fine but I'm struggling on how I can have multiple colors within an arc. Is there a way I plot multiple arcs within the same arc and style them independently?

Upvotes: 1

Views: 193

Answers (1)

ckersch
ckersch

Reputation: 7687

Rather than putting multiple colors within a single arc, I would recommend having a single arc for each color. This way, if your data changes, you can just change the lengths of each arc, rather than changing the gradient you're using.

A good example of this is here: d3 gallery donut chart

Upvotes: 1

Related Questions