# Trying to understand how to get stacked bar charts

**URL:** https://discuss.elastic.co/t/trying-to-understand-how-to-get-stacked-bar-charts/161413
**Category:** Kibana
**Created:** [December 18, 2018, 9:01pm UTC](https://discuss.elastic.co/t/trying-to-understand-how-to-get-stacked-bar-charts/161413 "2018-12-18T21:01:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![swright-eti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swright-eti/32/38743_2.png) [@swright-eti](https://discuss.elastic.co/u/swright-eti)
#### Post date: [December 18, 2018, 9:01pm UTC](https://discuss.elastic.co/t/trying-to-understand-how-to-get-stacked-bar-charts/161413/1 "2018-12-18T21:01:47Z")

</div>

I have data ingested from logs. There is a "log\_level" field for each message with possible values of ["INFO", "WARNING", "ERROR"]

I want a bar chart that shows the count of each log level in hourly intervals. So I should have a bar segment for each log level that represents the number of matching documents for that hour.

My first pass at this was to create a Visualization that had 3 counts for Y axes, one for each log level and then adding a query in the JSON input section. That just gave me 3 segments of equal length for each time slot.

I then tried to use sum in the Y axis to get a count of log\_level, but it does not appear as a field that I can use.

Not exactly sure how to go about this. I am going to do some digging on the docs, but if anyone can point me in the right direction I would really appreciate it.

Thanks.

---

<div class="post-metadata">

### Author: ![swright-eti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swright-eti/32/38743_2.png) [@swright-eti](https://discuss.elastic.co/u/swright-eti)
#### Post date: [December 19, 2018, 12:00pm UTC](https://discuss.elastic.co/t/trying-to-understand-how-to-get-stacked-bar-charts/161413/2 "2018-12-19T12:00:36Z")

</div>

Ok I have figure out what I needed to do. The Y-axis is just a count. The X-axis gets 2 buckets. The first is a Date Histogram for @timestamp. The second is a Split Series for terms. In my case the term is log\_level. Pretty straightforward actually.

---

<div class="post-metadata">

### Author: ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)
#### Post date: [December 19, 2018, 6:51pm UTC](https://discuss.elastic.co/t/trying-to-understand-how-to-get-stacked-bar-charts/161413/3 "2018-12-19T18:51:39Z")

</div>

Thanks for posting the solution back here.

cheers  
Rashmi

---

<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: [January 16, 2019, 6:51pm UTC](https://discuss.elastic.co/t/trying-to-understand-how-to-get-stacked-bar-charts/161413/4 "2019-01-16T18:51:42Z")

</div>

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