-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use text for relative timestamps and numbers for absolute
Using text like `now` and `now-12h` will not spam the browser's history like reported in #590. However, selecting a specific time range with the cursor in the graphs will now still select the very specific timestamps and store them in the URL.
- Loading branch information
1 parent
9505c21
commit 43a8013
Showing
6 changed files
with
74 additions
and
6 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
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,10 @@ | ||
import uPlot from 'uplot' | ||
|
||
export const selectTimeRange = | ||
(updateTimeRange: (min: number, max: number, absolute: boolean) => void) => (u: uPlot) => { | ||
if (u.select.width > 0) { | ||
const min = u.posToVal(u.select.left, 'x') | ||
const max = u.posToVal(u.select.left + u.select.width, 'x') | ||
updateTimeRange(Math.floor(min * 1000), Math.floor(max * 1000), true) | ||
} | ||
} |
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