From 62fdd053bc268d9c9aaf017e35931aa688dc7900 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Sat, 30 Oct 2021 13:24:39 -0400 Subject: [PATCH] [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 --- .../shared/charts/transaction_distribution_chart/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/apm/public/components/shared/charts/transaction_distribution_chart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/transaction_distribution_chart/index.tsx index 1a1ea13fa45ec0..dcf52cebaeedac 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/transaction_distribution_chart/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/transaction_distribution_chart/index.tsx @@ -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),