Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use bar chart
  • Loading branch information
BrunoQuaresma committed Aug 16, 2023
commit 45218d0366ec245301bc7f33dda6879005178fac
19 changes: 10 additions & 9 deletions site/src/components/DAUChart/DAUChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import {
defaults,
Legend,
LinearScale,
LineElement,
PointElement,
BarElement,
TimeScale,
Title,
Tooltip,
Expand All @@ -23,14 +22,13 @@ import {
} from "components/Tooltips/HelpTooltip"
import dayjs from "dayjs"
import { FC } from "react"
import { Line } from "react-chartjs-2"
import { Bar } from "react-chartjs-2"

ChartJS.register(
CategoryScale,
LinearScale,
TimeScale,
PointElement,
LineElement,
BarElement,
Title,
Tooltip,
Legend,
Expand All @@ -54,7 +52,7 @@ export const DAUChart: FC<DAUChartProps> = ({ daus }) => {
defaults.font.family = theme.typography.fontFamily as string
defaults.color = theme.palette.text.secondary

const options: ChartOptions<"line"> = {
const options: ChartOptions<"bar"> = {
responsive: true,
plugins: {
legend: {
Expand All @@ -70,7 +68,7 @@ export const DAUChart: FC<DAUChartProps> = ({ daus }) => {
},
x: {
ticks: {
stepSize: 2,
stepSize: daus.entries.length > 10 ? 2 : undefined,
},
type: "time",
time: {
Expand All @@ -82,17 +80,20 @@ export const DAUChart: FC<DAUChartProps> = ({ daus }) => {
}

return (
<Line
<Bar
data-chromatic="ignore"
data={{
labels: labels,
datasets: [
{
label: "Daily Active Users",
data: data,
tension: 1 / 4,
backgroundColor: theme.palette.secondary.dark,
borderColor: theme.palette.secondary.dark,
barThickness: 8,
borderWidth: 2,
borderRadius: Number.MAX_VALUE,
borderSkipped: false,
},
],
}}
Expand Down