cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Pie chart code error

toufic_chamandi
Dynatrace Guide
Dynatrace Guide

Hello team, I've been getting an error while trying to create the pie chart, I've even copied the code available in the documentation and I've been getting this error:

error: TS2322 Type '{ slices: { category: string; value: number; }[]; unit: string; }' is not assignable to type '{ category: string; value: number; }[]'.

Any ideas on why it might be doing this ?

2 REPLIES 2

josef_schiessl
Dynatrace Helper
Dynatrace Helper

Hey,
looks like you instead of passing the whole conversions object into the pie chart, you are only passing in the slices array. Can you share your code?

SarahRiener
Dynatrace Enthusiast
Dynatrace Enthusiast

I've noticed that there has been a working solution proposed on our internal Slack, so I am cross-posting it here as a reference for others encountering the same problem.

The version of the pie-chart component you use differs from the docs.
The type you provide:
{
  slices: {
    category: string;
    value: number; }[];
  unit: string;
}
The expected type:
{
  category: string;
  value: number
}[]
The slices are now on the root level.

Featured Posts