-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Domain buffer func 2nd pass post PR comments & CI test config
- Loading branch information
Showing
7 changed files
with
221 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Heartbeat endpoint for the Quartz app | ||
|
||
import { NextApiRequest, NextApiResponse } from "next"; | ||
|
||
export default function handler(req: NextApiRequest, res: NextApiResponse) { | ||
res.status(200).json({ status: "ok" }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
/** | ||
* Calculates the domain for a chart axis with an upper buffer. | ||
* | ||
* @param dataMax - The maximum data value that will be plotted on the chart. | ||
* @param roundingTickAmount - The value to which the maximum data value should be rounded up. | ||
* @param buffer - The buffer amount to be added to the maximum data value before rounding. | ||
* @returns An array where the first element is the minimum domain value (always 0) | ||
* and the second element is the maximum domain value, calculated by | ||
* rounding up the sum of the maximum data value and the buffer to the | ||
* nearest multiple of the rounding tick amount. | ||
*/ | ||
export const getDomainWithUpperBuffer = ( | ||
[dataMin, dataMax]: [number, number], | ||
dataMax: number, | ||
roundingTickAmount: number, | ||
buffer: number | ||
): [number, number] => { | ||
return [0, Math.floor((dataMax + buffer) / 1000) * 1000 + 1000]; | ||
if (roundingTickAmount <= 0) return [0, dataMax + buffer]; | ||
const roundedMax = | ||
Math.ceil((dataMax + buffer) / roundingTickAmount) * roundingTickAmount; | ||
return [0, roundedMax]; | ||
}; |
Oops, something went wrong.