How to assign custom colors to bars in a D3.js bar chart?
问题 I am using LeafletJs and D3js to put a bar chart in a Leaflet popup window. How can I assign a custom color for each ethnic group bar? I want to assign the custom colors within the D3 code because I can't modify the original dataset. Link Thanks. var onEachFeature = function onEachFeature(feature, layer) { colors = d3.scale.category20() var div = $('<div id="chart"><h3>Ethnic Group Distribution</h3><svg/><h4>Additional details:</h4>Extra stuff here</div>')[0]; var popup = L.popup({ minWidth: