# Unstacked bar charts for 3 concurrent different date fields

**URL:** https://discuss.elastic.co/t/unstacked-bar-charts-for-3-concurrent-different-date-fields/167019
**Category:** Kibana
**Created:** [February 4, 2019, 7:26pm UTC](https://discuss.elastic.co/t/unstacked-bar-charts-for-3-concurrent-different-date-fields/167019 "2019-02-04T19:26:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ebalmeida](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebalmeida/32/47103_2.png) [@ebalmeida](https://discuss.elastic.co/u/ebalmeida)
#### Post date: [February 4, 2019, 7:26pm UTC](https://discuss.elastic.co/t/unstacked-bar-charts-for-3-concurrent-different-date-fields/167019/1 "2019-02-04T19:26:59Z")

</div>

Hi, I'm trying to plot two different counts of date value fields (register\_date and conclusion\_date) and a third which should be calculated (should be the cummulative sum of registered docs - the cumulative sum of concluded. Also having trouble calculating it).

Using the traditional Vertical Bar visualization I found no way to plot both date fields witout aggregating one within the other (ie: only show the register\_date per conclusion\_date or vice-versa) - I believe it would be possible if I could open more than one X-Axis, but ideally I'd like to plot both on the same "neutral" time axis.

I tried it in timelion, and in the visual builder as well, which do plot both counts independently. However both don't seem to be able to plot the bars unstacked. I've scoured the docs and didn't find how to do that.

Regarding the third field, I managed the cummulative sum of registered docs easily using the cummulative sum metric, but I'm not quite sure how to subtract the cummulative sum of concluded docs.

Any help would be appreciated. Thank you.

---

<div class="post-metadata">

### Author: ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)
#### Post date: [February 5, 2019, 12:15am UTC](https://discuss.elastic.co/t/unstacked-bar-charts-for-3-concurrent-different-date-fields/167019/2 "2019-02-05T00:15:16Z")

</div>

With timelion, you could use `.bars(stack=false)` to unstack the bars. e.g.

`.es(index=my_dates, timefield=register_date).bars(width=30, stack=false), .es(index=my_dates, timefield=conclusion_date).bars(width=10, stack=false)`

Timelion also has [mathematical functions](https://www.elastic.co/guide/en/kibana/current/timelion-math.html) that might help with the third field (ex. `subtract()`).

---

<div class="post-metadata">

### Author: ![ebalmeida](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebalmeida/32/47103_2.png) [@ebalmeida](https://discuss.elastic.co/u/ebalmeida)
#### Post date: [February 5, 2019, 12:58pm UTC](https://discuss.elastic.co/t/unstacked-bar-charts-for-3-concurrent-different-date-fields/167019/3 "2019-02-05T12:58:30Z")

</div>

Thanks for the mathematical functions link. I figured there might be something but had trouble finding it.

I had tried the stack=false in timelion before, but it always draws the bars behind one another instead of beside one another. That's the same behaviour exhibited by the Visual Builder by the way. Any way to change that?

---

<div class="post-metadata">

### Author: ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)
#### Post date: [February 5, 2019, 10:44pm UTC](https://discuss.elastic.co/t/unstacked-bar-charts-for-3-concurrent-different-date-fields/167019/4 "2019-02-05T22:44:53Z")

</div>

Maybe you can change the `bars.width` or `offset` the series?

[https://www.elastic.co/guide/en/kibana/current/timelion-create.html](https://www.elastic.co/guide/en/kibana/current/timelion-create.html)

---

<div class="post-metadata">

### Author: ![ebalmeida](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebalmeida/32/47103_2.png) [@ebalmeida](https://discuss.elastic.co/u/ebalmeida)
#### Post date: [February 7, 2019, 3:29pm UTC](https://discuss.elastic.co/t/unstacked-bar-charts-for-3-concurrent-different-date-fields/167019/5 "2019-02-07T15:29:56Z")

</div>

Thanks a lot for the tip. I had actually played before with those values and gave it another shot, but it really doesn't fix the issue, since offset will throw the data at the wrong bucket (as it should).

I "fixed it" by using different widths for different data (making it show behind) and reorienting the concluded cases as negatives, which turned out quite nice. Unfortunately this is not ideal for other use cases and therefore I'm still on the hunt for a better solution.

Another issue, which I raised regarding the standard vertical bar visualization, is that I believe there should be just one label per bucket when timelion (or the vertical bars for that matter) simply choose a number of labels based on the chart width and repeats the label. It looks confusing (and dare I say kind of ugly) to say the least. Do you know of any way to fix the number of buckets shown? Perharps that would fix it.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/b/0b78d37ee070c1ad3d5ab0382ac7f1570cf839ff.png)

---

<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: [March 7, 2019, 3:29pm UTC](https://discuss.elastic.co/t/unstacked-bar-charts-for-3-concurrent-different-date-fields/167019/6 "2019-03-07T15:29:58Z")

</div>

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