Horizontal barchart X-axis - controlling range

On the horizontal barchart, I'm using a simple count. For example, the count might range from 0-5. The barchart currently labels the X-axis a 0.0, 0.5, 1.0, 1.5, …

How do I control the x-axis so that it only labels whole numbers (0,1,2,3,4,5) rather than also including the .5 labels?

Hi Gary,

Maybe @timroes can help share info if there is a way to do this?

Thanks,
Liza

Hi,

that is unfortunately currently not possible. We're trying to implement that in a future version.

Cheers,
Tim

Actually setting the axis interval size is available in Canvas only for number axes on plot elements which includes the horizontal bar chart.

Here's an example:

Original:
34%20PM

With a ticks in 100 intervals:
14%20PM

filters
| demodata
| pointseries x="size(cost)" y="project" color="project"
| plot defaultStyle={seriesStyle bars=0.75 horizontalBars=true} 
   legend=false 
   xaxis={axisConfig tickSize=100} 
| render

@gbarnett For you chart, you just need to add a xaxis={axisConfig tickSize=1} to your plot function.

2 Likes

Catherine, this works great! However, my graph differs from your example in that mine shows one decimal point. For example, 1.0, 2.0, 3.0, etc. In your example, there is no decimal point. Any idea how to suppress this?

It looks like that's how it's auto formatted by the plot element. There currently isn't a way to change the format of the labels, but there is an issue to add support for custom formatting that you can track here: https://github.com/elastic/kibana/issues/27926.

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