Skip to content

Commit 45218d0

Browse files
committed
Use bar chart
1 parent ff9252c commit 45218d0

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

site/src/components/DAUChart/DAUChart.tsx

+10-9
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import {
99
defaults,
1010
Legend,
1111
LinearScale,
12-
LineElement,
13-
PointElement,
12+
BarElement,
1413
TimeScale,
1514
Title,
1615
Tooltip,
@@ -23,14 +22,13 @@ import {
2322
} from "components/Tooltips/HelpTooltip"
2423
import dayjs from "dayjs"
2524
import { FC } from "react"
26-
import { Line } from "react-chartjs-2"
25+
import { Bar } from "react-chartjs-2"
2726

2827
ChartJS.register(
2928
CategoryScale,
3029
LinearScale,
3130
TimeScale,
32-
PointElement,
33-
LineElement,
31+
BarElement,
3432
Title,
3533
Tooltip,
3634
Legend,
@@ -54,7 +52,7 @@ export const DAUChart: FC<DAUChartProps> = ({ daus }) => {
5452
defaults.font.family = theme.typography.fontFamily as string
5553
defaults.color = theme.palette.text.secondary
5654

57-
const options: ChartOptions<"line"> = {
55+
const options: ChartOptions<"bar"> = {
5856
responsive: true,
5957
plugins: {
6058
legend: {
@@ -70,7 +68,7 @@ export const DAUChart: FC<DAUChartProps> = ({ daus }) => {
7068
},
7169
x: {
7270
ticks: {
73-
stepSize: 2,
71+
stepSize: daus.entries.length > 10 ? 2 : undefined,
7472
},
7573
type: "time",
7674
time: {
@@ -82,17 +80,20 @@ export const DAUChart: FC<DAUChartProps> = ({ daus }) => {
8280
}
8381

8482
return (
85-
<Line
83+
<Bar
8684
data-chromatic="ignore"
8785
data={{
8886
labels: labels,
8987
datasets: [
9088
{
9189
label: "Daily Active Users",
9290
data: data,
93-
tension: 1 / 4,
9491
backgroundColor: theme.palette.secondary.dark,
9592
borderColor: theme.palette.secondary.dark,
93+
barThickness: 8,
94+
borderWidth: 2,
95+
borderRadius: Number.MAX_VALUE,
96+
borderSkipped: false,
9697
},
9798
],
9899
}}

0 commit comments

Comments
 (0)