Created
June 19, 2019 18:37
-
-
Save jenil/81dc9417519ad93c561c36539d3b2d65 to your computer and use it in GitHub Desktop.
Generate mock data for time series used in graphs
This file contains hidden or 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
export function makeSeries(seriesCount: number, points: number) { | |
return Array(seriesCount) | |
.fill({ | |
data: [], | |
}) | |
.map(s => { | |
return { | |
data: Array(points) | |
.fill(1) | |
.map((d, i) => [ | |
new Date(Date.now() - i * 3600000), | |
Math.max(250, (Math.random() * 3000) | 0), | |
]), | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment