# Create a piechart based on values

**URL:** <https://discuss.elastic.co/t/create-a-piechart-based-on-values/365368>\
**Category:** Kibana\
**Created:** [August 22, 2024, 10:20am UTC](https://discuss.elastic.co/t/create-a-piechart-based-on-values/365368 "2024-08-22T10:20:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![javidr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javidr/32/136982_2.png) [@javidr](https://discuss.elastic.co/u/javidr)\
**Post date:** [August 22, 2024, 10:20am UTC](https://discuss.elastic.co/t/create-a-piechart-based-on-values/365368/1 "2024-08-22T10:20:04Z")

</div>

Hi

I have a document with the number of items in stock used and unused

{total: 50, used: 38, unused: 12}

How can i create a pie chart to display as the total, 50, and split it in used and unused?

I have been able to split the chart, but it creates an inner donut, rather than splitting the main one in different slices

Thanks

---

<div class="post-metadata">

**Author:** ![Alex\_Salgado-Elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_salgado-elastic/32/103081_2.png) [@Alex\_Salgado-Elastic](https://discuss.elastic.co/u/Alex_Salgado-Elastic)\
**Post date:** [August 22, 2024, 10:32am UTC](https://discuss.elastic.co/t/create-a-piechart-based-on-values/365368/2 "2024-08-22T10:32:12Z")

</div>

Hi @javidr ,

Could you show your index mapping results?

`GET your-index/_mapping`

---

<div class="post-metadata">

**Author:** ![javidr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javidr/32/136982_2.png) [@javidr](https://discuss.elastic.co/u/javidr)\
**Post date:** [August 22, 2024, 3:33pm UTC](https://discuss.elastic.co/t/create-a-piechart-based-on-values/365368/3 "2024-08-22T15:33:03Z")

</div>

```auto
{
  "items": {
    "mappings": {
      "properties": {
        "date": {
          "type": "date",
          "format": "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis"
        },
        "total": {
          "type": "long"
        },
        "unused": {
          "type": "long"
        },
        "used": {
          "type": "long"
        }
      }
    }
  }
}

```
