# Bar chart from field value

**URL:** https://discuss.elastic.co/t/bar-chart-from-field-value/89764
**Category:** Kibana
**Created:** [June 16, 2017, 6:49pm UTC](https://discuss.elastic.co/t/bar-chart-from-field-value/89764 "2017-06-16T18:49:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Makra](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@Makra](https://discuss.elastic.co/u/Makra)
#### Post date: [June 16, 2017, 6:49pm UTC](https://discuss.elastic.co/t/bar-chart-from-field-value/89764/1 "2017-06-16T18:49:10Z")

</div>

Hi  
I have three fields in the JSON like

"A": [  
"97.0"  
],  
"B": [  
"95.0"  
],  
"C": [  
"140.0"  
],  
...............  
...............

Want to draw a bar chart for the above with field name (A,B,C) in the X-axis and their value (97.0,95.0,140.0) in the Y-axis. How should i proceed ?

Regards

---

<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: [June 17, 2017, 6:30am UTC](https://discuss.elastic.co/t/bar-chart-from-field-value/89764/2 "2017-06-17T06:30:43Z")

</div>

if you index your documents into something like: { name: A, value: 97} ...

then you can do a term split on name (for your x axis) and set value as a metric (probably average)

---

<div class="post-metadata">

### Author: ![Makra](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@Makra](https://discuss.elastic.co/u/Makra)
#### Post date: [June 18, 2017, 5:59pm UTC](https://discuss.elastic.co/t/bar-chart-from-field-value/89764/3 "2017-06-18T17:59:49Z")

</div>

Hi  
@ppisljar  
I have converted the fields A, B and C to integer in filter section-

```
mutate {

                convert => {
                              "A" => "integer"
                              "B" => "integer"
                              "C" => "integer"

                 }
} 

```

Then i re-index the documents to get the above three fields as numbers.

Once fields are available, in the bar chart section i have choosen X-axis as @timestamp date ranges and the fields A, B and C in Y-axis under the max aggregation. The bar mode being normal. I got the following.

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

---

<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: [June 19, 2017, 6:59am UTC](https://discuss.elastic.co/t/bar-chart-from-field-value/89764/4 "2017-06-19T06:59:36Z")

</div>

and what do you expect ? still trying to solve the first issue (no date was mentioned there ?)

---

<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: [July 17, 2017, 7:00am UTC](https://discuss.elastic.co/t/bar-chart-from-field-value/89764/5 "2017-07-17T07:00:00Z")

</div>

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