Skip to content

Commit

Permalink
Treat 0 as a valid value for the graph scale
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Fernández Gómez committed Sep 7, 2021
1 parent a539997 commit 3ab76b7
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,11 @@ const CriterionPreviewChart: React.FC<ChartProps> = ({
const hasData = series.length > 0;
const { yMin, yMax, xMin, xMax } = getDomain(filteredSeries, isStacked);
const chartDomain = {
max:
showThreshold && threshold && threshold.value
? Math.max(yMax, threshold.value) * 1.1
: yMax * 1.1, // Add 10% headroom.
min: showThreshold && threshold && threshold.value ? Math.min(yMin, threshold.value) : yMin,
max: showThreshold && threshold ? Math.max(yMax, threshold.value) * 1.1 : yMax * 1.1, // Add 10% headroom.
min: showThreshold && threshold ? Math.min(yMin, threshold.value) : yMin,
};

if (showThreshold && threshold && threshold.value && chartDomain.min === threshold.value) {
if (showThreshold && threshold && chartDomain.min === threshold.value) {
chartDomain.min = chartDomain.min * 0.9; // Allow some padding so the threshold annotation has better visibility
}

Expand Down

0 comments on commit 3ab76b7

Please sign in to comment.