Pie Chart
✓ Published0🌍 Public
This example shows a basic pie chart of `basic_cost` values by country, using a Tableau10 color scale for each slice and text labels positioned at the arc centroids. The chart is rendered as an SVG within a 500×500 pixel container, with data loaded from a CSV hosted in a GitHub gist. Built with D3 v7, it creates the pie geometry with `d3.pie()` and `d3.arc()`, applies colors via `d3.scaleOrdinal`, and uses `d3.select` to set up the SVG group. The data parsing makes `basic_cost` numeric before generating the arcs.
AI-generated descriptionAn example showing the capabilities of VizHub:
- Loads D3 via UNPKG.
- Demonstrates use of
importfrom"d3". - Demonstrates use of
importfrom local ES6 modules.
MIT Licensed