I am trying to create a pie chart with elastic charts, and I'm having trouble trying to label the slices.
I'm following the example here. More specifically, for the layers prop:
layers={[
{
groupByRollup: (d: Datum) => d.sitc1,
nodeLabel: (d: Datum) => productLookup[d].name,
},
]}
The d
in groupByRollup
gives me the full entry for the data, but the d
in nodeLabel
only gives me the count for the data. There's no example for the productLookup
object in the storybook.
I assume, oddly, I need to go back to my data object and find the label with the corresponding count. But what if I have a dataset where 2 entries have the same count? How do I reliably get the label?
https://github.com/elastic/elastic-charts/issues/2172
Asked a question in the repo and got it figured out.