File tree 1 file changed +10
-9
lines changed
site/src/components/DAUChart
1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 9
9
defaults ,
10
10
Legend ,
11
11
LinearScale ,
12
- LineElement ,
13
- PointElement ,
12
+ BarElement ,
14
13
TimeScale ,
15
14
Title ,
16
15
Tooltip ,
@@ -23,14 +22,13 @@ import {
23
22
} from "components/Tooltips/HelpTooltip"
24
23
import dayjs from "dayjs"
25
24
import { FC } from "react"
26
- import { Line } from "react-chartjs-2"
25
+ import { Bar } from "react-chartjs-2"
27
26
28
27
ChartJS . register (
29
28
CategoryScale ,
30
29
LinearScale ,
31
30
TimeScale ,
32
- PointElement ,
33
- LineElement ,
31
+ BarElement ,
34
32
Title ,
35
33
Tooltip ,
36
34
Legend ,
@@ -54,7 +52,7 @@ export const DAUChart: FC<DAUChartProps> = ({ daus }) => {
54
52
defaults . font . family = theme . typography . fontFamily as string
55
53
defaults . color = theme . palette . text . secondary
56
54
57
- const options : ChartOptions < "line " > = {
55
+ const options : ChartOptions < "bar " > = {
58
56
responsive : true ,
59
57
plugins : {
60
58
legend : {
@@ -70,7 +68,7 @@ export const DAUChart: FC<DAUChartProps> = ({ daus }) => {
70
68
} ,
71
69
x : {
72
70
ticks : {
73
- stepSize : 2 ,
71
+ stepSize : daus . entries . length > 10 ? 2 : undefined ,
74
72
} ,
75
73
type : "time" ,
76
74
time : {
@@ -82,17 +80,20 @@ export const DAUChart: FC<DAUChartProps> = ({ daus }) => {
82
80
}
83
81
84
82
return (
85
- < Line
83
+ < Bar
86
84
data-chromatic = "ignore"
87
85
data = { {
88
86
labels : labels ,
89
87
datasets : [
90
88
{
91
89
label : "Daily Active Users" ,
92
90
data : data ,
93
- tension : 1 / 4 ,
94
91
backgroundColor : theme . palette . secondary . dark ,
95
92
borderColor : theme . palette . secondary . dark ,
93
+ barThickness : 8 ,
94
+ borderWidth : 2 ,
95
+ borderRadius : Number . MAX_VALUE ,
96
+ borderSkipped : false ,
96
97
} ,
97
98
] ,
98
99
} }
You can’t perform that action at this time.
0 commit comments