File tree Expand file tree Collapse file tree 4 files changed +34
-13
lines changed
components/WorkspaceSection Expand file tree Collapse file tree 4 files changed +34
-13
lines changed Original file line number Diff line number Diff line change 39
39
"axios" : " 0.26.1" ,
40
40
"can-ndjson-stream" : " 1.0.2" ,
41
41
"chart.js" : " ^3.5.0" ,
42
+ "chartjs-adapter-date-fns" : " 2.0.0" ,
42
43
"cron-parser" : " 4.6.0" ,
43
44
"cronstrue" : " 2.11.0" ,
45
+ "date-fns" : " 2.29.3" ,
44
46
"dayjs" : " 1.11.4" ,
45
47
"emoji-mart" : " ^5.2.1" ,
46
48
"eventsourcemock" : " ^2.0.0" ,
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export interface WorkspaceSectionProps {
11
11
*/
12
12
action ?: React . ReactNode
13
13
contentsProps ?: HTMLProps < HTMLDivElement >
14
- title ?: string
14
+ title ?: string | JSX . Element
15
15
}
16
16
17
17
export const WorkspaceSection : React . FC < React . PropsWithChildren < WorkspaceSectionProps > > = ( {
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import useTheme from "@material-ui/styles/useTheme"
2
2
3
3
import { Theme } from "@material-ui/core/styles"
4
4
import {
5
- BarElement ,
6
5
CategoryScale ,
7
6
Chart as ChartJS ,
8
7
ChartOptions ,
@@ -11,9 +10,11 @@ import {
11
10
LinearScale ,
12
11
LineElement ,
13
12
PointElement ,
13
+ TimeScale ,
14
14
Title ,
15
15
Tooltip ,
16
16
} from "chart.js"
17
+ import "chartjs-adapter-date-fns"
17
18
import { Stack } from "components/Stack/Stack"
18
19
import { HelpTooltip , HelpTooltipText , HelpTooltipTitle } from "components/Tooltips/HelpTooltip"
19
20
import { WorkspaceSection } from "components/WorkspaceSection/WorkspaceSection"
@@ -25,8 +26,8 @@ import * as TypesGen from "../../api/typesGenerated"
25
26
ChartJS . register (
26
27
CategoryScale ,
27
28
LinearScale ,
29
+ TimeScale ,
28
30
PointElement ,
29
- BarElement ,
30
31
LineElement ,
31
32
Title ,
32
33
Tooltip ,
@@ -81,23 +82,31 @@ export const DAUChart: FC<DAUChartProps> = ({ templateDAUs: templateMetricsData
81
82
} ,
82
83
x : {
83
84
ticks : { } ,
85
+ type : "time" ,
86
+ time : {
87
+ unit : "day" ,
88
+ stepSize : 2 ,
89
+ } ,
84
90
} ,
85
91
} ,
86
92
aspectRatio : 10 / 1 ,
87
93
} as ChartOptions
88
94
89
95
return (
90
96
< >
91
- < WorkspaceSection >
92
- < Stack direction = "row" spacing = { 1 } alignItems = "center" >
93
- < h3 > { Language . chartTitle } </ h3 >
94
- < HelpTooltip size = "small" >
95
- < HelpTooltipTitle > How do we calculate DAUs?</ HelpTooltipTitle >
96
- < HelpTooltipText >
97
- We use all workspace connection traffic to calculate DAUs.
98
- </ HelpTooltipText >
99
- </ HelpTooltip >
100
- </ Stack >
97
+ < WorkspaceSection
98
+ title = {
99
+ < Stack direction = "row" spacing = { 1 } alignItems = "center" >
100
+ { Language . chartTitle }
101
+ < HelpTooltip size = "small" >
102
+ < HelpTooltipTitle > How do we calculate DAUs?</ HelpTooltipTitle >
103
+ < HelpTooltipText >
104
+ We use all workspace connection traffic to calculate DAUs.
105
+ </ HelpTooltipText >
106
+ </ HelpTooltip >
107
+ </ Stack >
108
+ }
109
+ >
101
110
< Line
102
111
data = { {
103
112
labels : labels ,
Original file line number Diff line number Diff line change @@ -5442,6 +5442,11 @@ chart.js@^3.5.0:
5442
5442
resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-3.9.1.tgz#3abf2c775169c4c71217a107163ac708515924b8"
5443
5443
integrity sha512-Ro2JbLmvg83gXF5F4sniaQ+lTbSv18E+TIf2cOeiH1Iqd2PGFOtem+DUufMZsCJwFE7ywPOpfXFBwRTGq7dh6w==
5444
5444
5445
+ chartjs-adapter-date-fns@2.0.0:
5446
+ version "2.0.0"
5447
+ resolved "https://registry.yarnpkg.com/chartjs-adapter-date-fns/-/chartjs-adapter-date-fns-2.0.0.tgz#5e53b2f660b993698f936f509c86dddf9ed44c6b"
5448
+ integrity sha512-rmZINGLe+9IiiEB0kb57vH3UugAtYw33anRiw5kS2Tu87agpetDDoouquycWc9pRsKtQo5j+vLsYHyr8etAvFw==
5449
+
5445
5450
chokidar@^2.1.8:
5446
5451
version "2.1.8"
5447
5452
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917"
@@ -6243,6 +6248,11 @@ data-urls@^2.0.0:
6243
6248
whatwg-mimetype "^2.3.0"
6244
6249
whatwg-url "^8.0.0"
6245
6250
6251
+ date-fns@2.29.3:
6252
+ version "2.29.3"
6253
+ resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8"
6254
+ integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==
6255
+
6246
6256
dayjs@1.11.4:
6247
6257
version "1.11.4"
6248
6258
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.4.tgz#3b3c10ca378140d8917e06ebc13a4922af4f433e"
You can’t perform that action at this time.
0 commit comments