# Stacked chart with Kibana

**URL:** <https://discuss.elastic.co/t/stacked-chart-with-kibana/132605>\
**Category:** Kibana\
**Created:** [May 20, 2018, 8:48pm UTC](https://discuss.elastic.co/t/stacked-chart-with-kibana/132605 "2018-05-20T20:48:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SarojELK](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sarojelk/32/51907_2.png) [@SarojELK](https://discuss.elastic.co/u/SarojELK)\
**Post date:** [May 20, 2018, 8:48pm UTC](https://discuss.elastic.co/t/stacked-chart-with-kibana/132605/1 "2018-05-20T20:48:54Z")

</div>

Hello again Experts,

my Kibana skills are just starting with visualization.  
i have successfully ingested the data to ES and now i need to create a stacked chart as per attached picture,

i needed to plot a stacked chart for 'TimeSpent' with 'Num\_Objects' against different function Type, X axis should carry the @timestamp

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/8/e8e96cab2170326149cc3c075b0d374e6eaa4f18.png)

Any help would be really appreciable, I am struggling from last 1 week to get this created.

BR  
ELK Rocks

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [May 21, 2018, 1:44pm UTC](https://discuss.elastic.co/t/stacked-chart-with-kibana/132605/2 "2018-05-21T13:44:37Z")

</div>

Hey @SarojELK,

It sounds like you're trying to build a Vertical Bar chart with a Date Histogram aggregations on the X-Axis and the TimeSpent on the Y-Axis.

This can be done with the following configuration in Visualize:

 ![57%20AM](https://us1.discourse-cdn.com/elastic/original/3X/2/b/2b5f5cc70739e8af00cd207fb4f03498a3844a23.jpg)

If you'd like to split the TimeSpent based on the function\_type, you can add a split series sub-aggregation with a terms aggregation on the "Function\_Type" as displayed below:

 ![00%20AM](https://us1.discourse-cdn.com/elastic/original/3X/b/4/b45098674fad5ed887a4a2c6027eba7d8a4d2fb8.png)

giving you a graph similar to the following:

 ![42%20AM](https://us1.discourse-cdn.com/elastic/original/3X/9/a/9a610524d89b3afb71de1b8076808d4471277e37.jpg)

This graph is excluding the Num\_Objects aspect, as I'm unsure how you'd like that to be reflected in your chart.

---

<div class="post-metadata">

**Author:** ![SarojELK](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sarojelk/32/51907_2.png) [@SarojELK](https://discuss.elastic.co/u/SarojELK)\
**Post date:** [May 21, 2018, 1:55pm UTC](https://discuss.elastic.co/t/stacked-chart-with-kibana/132605/3 "2018-05-21T13:55:14Z")

</div>

Hey @Brandon_Kobel,

I guess, i found my issue in my data, how i have ingested into ES.  
my Num\_Objects & TimeSpent both got mapped as in type :keyword, which needed to be number or integer.  
do you have any suggestion? how can i convert the type from keyword to integer or number for data already indexed ?  
even if i need to re-index the data how should point my own mapping? in filebeat or logstash ?

```auto
"mappings": {
      "doc": {
        "properties": {
          "@timestamp": {
            "type": "date"
          },
          "@version": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "Function_Type": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "Num_Objects": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "TimeSpent": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256

```

DO you have any suggestion ?

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [May 21, 2018, 2:09pm UTC](https://discuss.elastic.co/t/stacked-chart-with-kibana/132605/4 "2018-05-21T14:09:20Z")

</div>

Hey @SarojELK, I'd suggest starting by creating a new Index and specifying the proper mappings per the [docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html#mappings). You can then point your newly ingested data at the new indices, and then use the [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) to copy over the historical data with the proper types.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 18, 2018, 2:09pm UTC](https://discuss.elastic.co/t/stacked-chart-with-kibana/132605/5 "2018-06-18T14:09:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
