Skip to content

Commit b917ef6

Browse files
committed
Theme chart
1 parent 96f27c6 commit b917ef6

File tree

5 files changed

+36
-9
lines changed

5 files changed

+36
-9
lines changed

coderd/database/dump.sql

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/models.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/metrics.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func (api *API) workspaceAgentReportStats(rw http.ResponseWriter, r *http.Reques
189189
lastReport = rep
190190

191191
_, err = api.Database.InsertAgentStat(ctx, database.InsertAgentStatParams{
192-
ID: uuid.NewString(),
192+
ID: uuid.New(),
193193
CreatedAt: time.Now(),
194194
AgentID: workspaceAgent.ID,
195195
WorkspaceID: build.WorkspaceID,

site/src/pages/UsersPage/DAUChart.tsx

+32-5
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,29 @@ export interface DAUChartProps {
1010
userMetricsData: TypesGen.GetDAUsResponse
1111
}
1212

13+
import useTheme from "@material-ui/styles/useTheme"
14+
15+
import { Theme } from "@material-ui/core/styles"
1316
import {
1417
CategoryScale,
1518
Chart as ChartJS,
1619
ChartOptions,
20+
defaults,
1721
Legend,
1822
LinearScale,
1923
LineElement,
2024
PointElement,
2125
Title,
2226
Tooltip,
2327
} from "chart.js"
28+
import { Stack } from "components/Stack/Stack"
29+
import { HelpTooltip, HelpTooltipText, HelpTooltipTitle } from "components/Tooltips/HelpTooltip"
2430

2531
ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend)
2632

2733
export const DAUChart: FC<DAUChartProps> = ({ userMetricsData }) => {
34+
const theme: Theme = useTheme()
35+
2836
const labels = userMetricsData.entries.map((val) => {
2937
return moment(val.date).format("l")
3038
})
@@ -33,6 +41,8 @@ export const DAUChart: FC<DAUChartProps> = ({ userMetricsData }) => {
3341
return val.daus
3442
})
3543

44+
defaults.font.family = theme.typography.fontFamily
45+
3646
const options = {
3747
responsive: true,
3848
plugins: {
@@ -43,25 +53,42 @@ export const DAUChart: FC<DAUChartProps> = ({ userMetricsData }) => {
4353
scales: {
4454
y: {
4555
min: 0,
56+
ticks: {
57+
precision: 0,
58+
},
59+
},
60+
x: {
61+
ticks: {},
4662
},
47-
x: {},
4863
},
4964
aspectRatio: 6 / 1,
5065
} as ChartOptions
5166

5267
return (
5368
<>
54-
{/* <p>{JSON.stringify(chartData)}</p> */}
55-
56-
<WorkspaceSection title="Daily Active Users">
69+
{/* <WorkspaceSection title="Daily Active Users"> */}
70+
<WorkspaceSection>
71+
<Stack direction="row" spacing={1} alignItems="center">
72+
<h3>Daily Active Users</h3>
73+
<HelpTooltip size="small">
74+
<HelpTooltipTitle>How do we calculate DAUs?</HelpTooltipTitle>
75+
<HelpTooltipText>
76+
We use daily, unique workspace connection traffic to compute DAUs.
77+
</HelpTooltipText>
78+
</HelpTooltip>
79+
</Stack>
5780
<Line
5881
data={{
5982
labels: labels,
6083
datasets: [
6184
{
85+
label: "Daily Active Users",
6286
data: data,
87+
lineTension: 1 / 4,
88+
backgroundColor: theme.palette.secondary.dark,
89+
borderColor: theme.palette.secondary.dark,
6390
},
64-
],
91+
] as any,
6592
}}
6693
options={options as any}
6794
height={400}

0 commit comments

Comments
 (0)