Canvas - Rounding point series axis data

I am facing couple of issues with Canvas pointseries.

  1. I am using x-axis as @timestamp and y-axis is average of a field. The issue is that sometime average can have more than 2 digits after the decimal point but the Canvas is not rounding up the value. For example, it is displaying 88.89456. Is there any way to round this value while displaying?

  2. In case of no values retrieved by the query, the graph is like below image, the y-axis is starting with -1.0 instead of 0.0. Can we fix that somehow?

image

EDIT : Kibana and Elastic Version :- 6.8.2
Please let me know

@rajeev1

  1. You can use the round function available in TinyMath to round the number values to two decimal places. For example, pointseries x=@timestamp y="round(mean(price),2)".

  2. Are you talking about displaying 0 as the lower bound for the y-axis? You can set the min and max range on a number axis by passing an axisConfig to the yaxis argument in the plot function . For example, plot yaxis={axisConfig min=0}

Thanks @Catherine_Liu!

I tried both before and again; but it doesnt seems working with Canvas. I tried with the timelion .yaxis(min, max) option as well, didnt work with Canvas either, worked perfectly on timelion view.

@rajeev1 Can you share the expression on your element?

filters
| timelion 
  query=".es(q='SubCategory:\"SCM Tooling\"', metric=avg:Rating, index=devops-culture-05)" interval="30d"
| pointseries y="round(mean(value), 2)" x="@timestamp"
| plot defaultStyle={seriesStyle lines="2" points="0" bars="0"}
| render

Used for rounding, after this as well, the rounding is not happening

This is the one I am using for the MIN value

filters
| timelion
query=".es(index='test-index*', q='(status:"SUCCESS") AND (metrics.new_coverage.status:"OK")', metric=avg:metrics.new_coverage.value)" interval="7d"
| pointseries x="@timestamp" y="value"
| plot defaultStyle={seriesStyle bars=0 lines=4 horizontalBars=false color="#fd1d1d"} legend=false yaxis={axisConfig min=0}
| render

@Catherine_Liu - Strangely, if I do like below it just display an empty Y axis if I dont have any data to plot. Not just 0.1 any value greater than '0' should give the same behaviour
yaxis={axisConfig min=0.1}

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