Skip to content

Commit

Permalink
Set the height of the selection annotation dynamically based on the m…
Browse files Browse the repository at this point in the history
…ax y domain value.
  • Loading branch information
walterra committed Aug 11, 2022
1 parent 52cf77e commit 62db8d8
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ export function DurationDistributionChart({
...flatten(data.map((d) => d.histogram)).map((d) => d.doc_count)
) ?? 0;
const yTicks = Math.max(1, Math.ceil(Math.log10(yMax)));
const yAxisMaxDomain = Math.pow(10, yTicks);
const yAxisDomain = {
min: Y_AXIS_MIN_DOMAIN,
max: Math.pow(10, yTicks),
max: yAxisMaxDomain,
};

const selectionAnnotation =
Expand All @@ -156,7 +157,7 @@ export function DurationDistributionChart({
x0: selection[0],
x1: selection[1],
y0: 0,
y1: 100000,
y1: yAxisMaxDomain,
},
details: 'selection',
},
Expand Down

0 comments on commit 62db8d8

Please sign in to comment.