Skip to content

Instantly share code, notes, and snippets.

@jenil
Created June 19, 2019 18:37
Show Gist options
  • Save jenil/81dc9417519ad93c561c36539d3b2d65 to your computer and use it in GitHub Desktop.
Save jenil/81dc9417519ad93c561c36539d3b2d65 to your computer and use it in GitHub Desktop.
Generate mock data for time series used in graphs
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