# Pie chart code error

**URL:** <https://community.dynatrace.com/t/pie-chart-code-error/37661>\
**Category:** Developer Q&A Forum\
**Tags:** strato, coding-assistance\
**Created:** [December 12, 2022, 4:06pm UTC](https://community.dynatrace.com/t/pie-chart-code-error/37661 "2022-12-12T16:06:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![toufic\_chamandi](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/toufic_chamandi/32/4356_2.png) [@toufic\_chamandi](https://community.dynatrace.com/u/toufic_chamandi)\
**Post date:** [December 12, 2022, 4:06pm UTC](https://community.dynatrace.com/t/pie-chart-code-error/37661/1 "2022-12-12T16:06:49Z")

</div>

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:

```auto
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 ?

---

<div class="post-metadata">

**Author:** ![josef\_schiessl](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@josef\_schiessl](https://community.dynatrace.com/u/josef_schiessl)\
**Post date:** [December 12, 2022, 9:15pm UTC](https://community.dynatrace.com/t/pie-chart-code-error/37661/2 "2022-12-12T21:15:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![SarahRiener](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@SarahRiener](https://community.dynatrace.com/u/SarahRiener)\
**Post date:** [December 13, 2022, 8:46am UTC](https://community.dynatrace.com/t/pie-chart-code-error/37661/3 "2022-12-13T08:46:26Z")

</div>

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:

```auto
{
  slices: {
    category: string;
    value: number; }[];
  unit: string;
}

```

The expected type:

```auto
{
  category: string;
  value: number
}[]

```

The slices are now on the root level.
