holtzy / D3-graph-gallery

A collection of simple graphics made with D3.js
https://www.d3-graph-gallery.com
MIT License
789 stars 237 forks source link

Small problem with v4 and v6 of pie chart basic #66

Open justUmen opened 2 years ago

justUmen commented 2 years ago

On the page https://www.d3-graph-gallery.com/graph/pie_basic.html I think the code v6 should be : .attr('fill', function(d){ return(color(d.data)) }) and not .attr('fill', function(d){ return(color(d.data[1])) }).

Otherwise, it isn't identical to the code for v4.

Example with different values : (messed up colors if numbers are similar) v4 - https://jsfiddle.net/jnve0fb9/ v6 - https://jsfiddle.net/z2jcwf3x/

I used your page for migrating to v6, but this details got me confused for a while.