Limiting axis to only integers

Hello!
I'm wondering if it is possible to limit the y-axis in different plots to show only integer values? We're showcasing the number of people doing different actions, therefore it really doesn't make sense to have decimal numbers on the plot. It usually just confuses people.

Example is shown below:
Screenshot_1

Ideally, we would like to have only numbers 1 and 2 on the axis. What are my options to achieve that?

Thank you in advance.

Where are you creating this chart above (i.e. Lens, aggs based, etc.)?

This is certainly possible with our charting library. I would like to see this globally applied for any count aggregations. Here is an issue pertaining to TSVB @elastic/kibana#28614. I opened a new issue to set this as default in Lens here @elastic/kibana#112324.

It looks like this is possible in Lens by setting the value format of the metric with decimals option set to 0.

Note there are some issue with setting decimals to 0, see @elastic/kibana#97100

-- UPDATED -- per @Janujc's comment below
Integer formatting is only used in count aggregations in aggregation based visualizations. However this is not the case for other non-count aggregations, for these, floating-point tick values are used below a certain value.

Thank you for your answer. I was able to solve this for my Lens charts. I was also able to solve it in TSVB with custom formatter and setting the "Format string" to 0.

The issue is still present in aggregation based charts. After one of the bars goes over the number 5, the y-axis scale is correct, as is shown on your picture. For lower numbers I believe the scale remains with decimal numbers. I still haven't found a way to solve this.

image

Thanks for that clarification :+1:, I updated my initial post to avoid confusion. This however is only the case for non-count aggregations. We can only determine the agg type is count, see code and gif below. It would be great to apply this if the type is a number with a pattern set to an integer.

Screen Recording 2021-09-16 at 09.02.33 AM

Yes TSVB won't work until @elastic/kibana#28614 is closed.

FYI this issue @elastic/kibana#97100 is better for tracking change to tick formatting in Lens.

Is unique count also considered a non-count aggregation? Because that is the problem I am facing. It would be nice if it worked as you suggested, especially in the case of unique count aggregation.

Is unique count also considered a non-count aggregation?

Unfortunately not currently, that is called cardinality agg not count. I am looking into adding this coercion for all counts and aggs of integer fields that are sensible, for example, percentile or standard deviation of an integer field may not make sense to have a strict integer axis.