d3.js-v5

How to put a legend in a pie chart in d3.js

穿精又带淫゛_ 提交于 2020-05-24 03:30:07
问题 I have this pie chart created in d3.js and want to put some legend on it. But the is almost all of the documentation i've read so far is only for d3.js version 3 and a lot has changed for v5. Some says that there is already a built in legend maker of d3 which i don't understand how to use it. Please help. Below is my code snippet of the pie chart: /** START OF PIE CHART */ var data = [{"region_iso_code":"PH-00","total_up_percentage":97.69},{"region_iso_code":"PH-01","total_up_percentage":99

How to put a legend in a pie chart in d3.js

痞子三分冷 提交于 2020-05-24 03:30:06
问题 I have this pie chart created in d3.js and want to put some legend on it. But the is almost all of the documentation i've read so far is only for d3.js version 3 and a lot has changed for v5. Some says that there is already a built in legend maker of d3 which i don't understand how to use it. Please help. Below is my code snippet of the pie chart: /** START OF PIE CHART */ var data = [{"region_iso_code":"PH-00","total_up_percentage":97.69},{"region_iso_code":"PH-01","total_up_percentage":99