forked from npmx-dev/npmx.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchart.ts
More file actions
63 lines (56 loc) · 1.37 KB
/
chart.ts
File metadata and controls
63 lines (56 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
export type ChartTimeGranularity = 'daily' | 'weekly' | 'monthly' | 'yearly'
export type DateRangeFields = {
startDate?: string
endDate?: string
}
export type DailyDataPoint = { value: number; day: string; timestamp: number; hasAnomaly?: boolean }
export type WeeklyDataPoint = {
value: number
weekKey: string
weekStart: string
weekEnd: string
timestampStart: number
timestampEnd: number
hasAnomaly?: boolean
}
export type MonthlyDataPoint = {
value: number
month: string
timestamp: number
hasAnomaly?: boolean
}
export type YearlyDataPoint = {
value: number
year: string
timestamp: number
hasAnomaly?: boolean
}
export type EvolutionData =
| DailyDataPoint[]
| WeeklyDataPoint[]
| MonthlyDataPoint[]
| YearlyDataPoint[]
type EvolutionOptionsBase = {
startDate?: string
endDate?: string
}
export type EvolutionOptionsDay = EvolutionOptionsBase & {
granularity: 'day'
}
export type EvolutionOptionsWeek = EvolutionOptionsBase & {
granularity: 'week'
weeks?: number
}
export type EvolutionOptionsMonth = EvolutionOptionsBase & {
granularity: 'month'
months?: number
}
export type EvolutionOptionsYear = EvolutionOptionsBase & {
granularity: 'year'
}
export type EvolutionOptions =
| EvolutionOptionsDay
| EvolutionOptionsWeek
| EvolutionOptionsMonth
| EvolutionOptionsYear
export type DailyRawPoint = { day: string; value: number }