-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hey Gabriela,
This section might be the reason why your pie chart is not showing.
When you call d3.pie(), you a new pie generator but it is not doing anything with your data.
Example:
const data = [
{"number": 4, "name": "Locke"},
{"number": 8, "name": "Reyes"},
{"number": 15, "name": "Ford"},
{"number": 16, "name": "Jarrah"},
{"number": 23, "name": "Shephard"},
{"number": 42, "name": "Kwon"}
];
const arcs = d3.pie()
.value(d => d.number)
(data);
Adding a value accessor
When you add d => d.number, it modifies the generator to look for and use the number value to calculate the angles within the pie chart.
const pieGenerator = d3.pie()
.value(d => d.number)
Getting calculated angles
const pieChartAngles = pieGenerator(data)
or
const pieChartAngles = d3.pie()
.value(d => d.number)(data)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels