# X axis aggregation on line chart

**URL:** <https://discuss.elastic.co/t/x-axis-aggregation-on-line-chart/115703>\
**Category:** Kibana\
**Created:** [January 16, 2018, 12:05pm UTC](https://discuss.elastic.co/t/x-axis-aggregation-on-line-chart/115703 "2018-01-16T12:05:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikelo](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@mikelo](https://discuss.elastic.co/u/mikelo)\
**Post date:** [January 16, 2018, 12:05pm UTC](https://discuss.elastic.co/t/x-axis-aggregation-on-line-chart/115703/1 "2018-01-16T12:05:04Z")

</div>

Hi All,

I'm trying to create a scatter plot but I need an aggregation on X-axis. Looks like you can aggregate only on Y-axis.

{"KEY": "K1", "COUNT\_1": 1, "COUNT\_2": 0, "TIME": "2016-04-08T00:00:00+00:00"}  
{"KEY": "K2", "COUNT\_1": 1, "COUNT\_2": 1, "TIME": "2016-04-08T00:00:00+00:00"}  
{"KEY": "K1", "COUNT\_1": 1, "COUNT\_2": 1, "TIME": "2016-04-09T00:00:00+00:00"}  
{"KEY": "K2", "COUNT\_1": 1, "COUNT\_2": 0, "TIME": "2016-04-09T00:00:00+00:00"}  
{"KEY": "K1", "COUNT\_1": 1, "COUNT\_2": 1, "TIME": "2016-04-10T00:00:00+00:00"}  
{"KEY": "K2", "COUNT\_1": 1, "COUNT\_2": 5, "TIME": "2016-04-10T00:00:00+00:00"}

In the line plot, I want something like

y axis: sum aggregation of COUNT\_1 (it works fine!)  
x axis: sum aggregation of COUNT\_2 (looks like I cannot do it)

I expect a scatter plot with 2 points:  
1st point "K1" (x=2,y=3)  
2nd point "K2" (x=6,y=3)

Thanks!

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [January 16, 2018, 7:19pm UTC](https://discuss.elastic.co/t/x-axis-aggregation-on-line-chart/115703/2 "2018-01-16T19:19:38Z")

</div>

I'm pretty sure there isn't any way to do this in Kibana. Aggregations can be used to define the x-axis, but aggregating on the sum of a field requires multiple aggregation stages and I'm pretty sure that none of the Kibana visualizations can accomplish this. Maybe @ppisljar has an idea?

---

<div class="post-metadata">

**Author:** ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)\
**Post date:** [January 17, 2018, 8:18am UTC](https://discuss.elastic.co/t/x-axis-aggregation-on-line-chart/115703/3 "2018-01-17T08:18:33Z")

</div>

i agree with spalger.

---

<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:** [February 14, 2018, 8:18am UTC](https://discuss.elastic.co/t/x-axis-aggregation-on-line-chart/115703/4 "2018-02-14T08:18:37Z")

</div>

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