[ML] Fix y axis ticks. (#116670) (#116896)

Fixes the y axis ticks for chart variants where the maximum transaction count for overall buckets is only 1.

Co-authored-by: Walter Rafelsberger <walter@elastic.co>
This commit is contained in:
Kibana Machine 2021-10-30 13:24:39 -04:00 committed by GitHub
parent 26b3137981
commit 62fdd053bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,7 +132,7 @@ export function TransactionDistributionChart({
Math.max(
...flatten(data.map((d) => d.histogram)).map((d) => d.doc_count)
) ?? 0;
const yTicks = Math.ceil(Math.log10(yMax));
const yTicks = Math.max(1, Math.ceil(Math.log10(yMax)));
const yAxisDomain = {
min: 0.5,
max: Math.pow(10, yTicks),