# Creating Bar Chart with missing values on the x axis

**URL:** https://discuss.elastic.co/t/creating-bar-chart-with-missing-values-on-the-x-axis/288967
**Category:** Kibana
**Tags:** canvas
**Created:** [November 11, 2021, 8:55am UTC](https://discuss.elastic.co/t/creating-bar-chart-with-missing-values-on-the-x-axis/288967 "2021-11-11T08:55:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bodach](https://avatars.discourse-cdn.com/v4/letter/b/a87d85/32.png) [@bodach](https://discuss.elastic.co/u/bodach)
#### Post date: [November 11, 2021, 8:55am UTC](https://discuss.elastic.co/t/creating-bar-chart-with-missing-values-on-the-x-axis/288967/1 "2021-11-11T08:55:16Z")

</div>

Hello,

I created a bar chart for different companies using a dropdown filter.

I want to see all the values there even if they dont have any related values for that column.

To give an example. This is showing all the values I have without the filter:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/6/76538a71ae1b635b15c89b2501af0b7bce649bbf.png)

And this one shows for a company:

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

As you can see its missing a lot of values and I know that s normal. But I want to see them on X axis anyway.

Is there anyway I can do this?

Here is my code:

```auto
filters 
|var_set name="results" 
  value={essql query="SELECT Contract_Value, count(distinct(Response_ID)) as count from \"preprocessed_transformed\" group by Contract_Value"}
| var name="results"
| var_set name="sum" value={ply expression={math "sum(count)"} | getCell "value"}
| var name="results"
| staticColumn name="sum" value={var name="sum"}
| mapColumn name="percent_of_sum" expression={math "count / sum" | formatnumber "0%"}
| sort by="count" reverse=true
| alterColumn "Contract_Value" name="Contract Value"
| alterColumn "percent_of_sum" name="Count (%)"
| mapColumn "Contract Value" fn={getCell "Contract Value" | replace "_P/Y" replacement=" "}
| columns exclude="count"
| columns exclude="sum"
| pointseries x="Contract Value" y="Count (%)" text="Count (%)"
| plot defaultStyle={seriesStyle bars=0.2 color="#005659"} legend=false yaxis=false
| render 
  containerStyle={containerStyle overflow="visible" border="1px none " borderRadius="8px"} 
  css=".canvasDataTable__th { text-decoration: underline; background-color: #669A9B; color: black}
.canvasDataTable__tbody>:nth-child(even) {
background-color:white;
}
.canvasDataTable__tbody>:nth-child(odd) {
background-color: #E5EEEE;
}
.valueLabel { margin-top: -15px; align: center; font-size: 16px; font-weight:bold                
 }
"

```

---

<div class="post-metadata">

### Author: ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)
#### Post date: [November 26, 2021, 10:02am UTC](https://discuss.elastic.co/t/creating-bar-chart-with-missing-values-on-the-x-axis/288967/2 "2021-11-26T10:02:31Z")

</div>

Hi there, you could create a bar chart visualization with specifying explicitly all the values as Filters and then use this visualization inside canvas. This is example for non-existing category still displaying in the axis:

 ![Screenshot 2021-11-26 at 11.02.15](https://us1.discourse-cdn.com/elastic/original/3X/b/5/b5931f16586053444c8f88e58026111d552718bc.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: [December 24, 2021, 10:02am UTC](https://discuss.elastic.co/t/creating-bar-chart-with-missing-values-on-the-x-axis/288967/3 "2021-12-24T10:02:51Z")

</div>

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