Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@trpc/client": "11.7.2",
"@trpc/next": "11.7.2",
"@trpc/react-query": "11.7.2",
"@trpc/server": "11.7.2",
"@trpc/server": "11.8.0",
"@uidotdev/usehooks": "2.4.1",
"@unleash/nextjs": "1.6.2",
"@vercel/analytics": "1.6.1",
Expand Down
11 changes: 10 additions & 1 deletion app/src/modules/statistics/components/StatisticChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ export const StatisticChart = ({ chart }: Props) => {
? chart.yAxes
: [{ position: "left" as const }];

const xAxisLabelSkipInterval = Math.max(
0,
Math.ceil(chart.axisTimestamps.length / 5) - 1,
);
const xAxisLabelInterval = xAxisLabelSkipInterval;

const option = {
backgroundColor: "transparent",
color: PALETTE,
Expand Down Expand Up @@ -155,7 +161,7 @@ export const StatisticChart = ({ chart }: Props) => {
data: chart.axisTimestamps,
axisLabel: {
color: "#737373",
interval: 0,
interval: xAxisLabelInterval,
formatter: (value: number | string) =>
formatDate(new Date(Number(value)), "extra_short"),
},
Expand All @@ -173,6 +179,8 @@ export const StatisticChart = ({ chart }: Props) => {
type: "value",
position: axis.position ?? (index === 0 ? "left" : "right"),
name: axis.name,
// Keep the Y axis readable by limiting tick count.
splitNumber: 5,
axisLabel: {
color: axisLabelColor,
},
Expand Down Expand Up @@ -201,6 +209,7 @@ export const StatisticChart = ({ chart }: Props) => {
},
lineStyle: {
width: 2,
...serie.lineStyle,
},
yAxisIndex: serie.yAxisIndex ?? 0,
data: chart.axisTimestamps.map((_, index) => serie.data[index] ?? null),
Expand Down
74 changes: 53 additions & 21 deletions app/src/modules/statistics/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export interface StatisticSeries {
name: string;
data: (number | null)[];
yAxisIndex?: number;
lineStyle?: {
type?: "solid" | "dashed" | "dotted";
width?: number;
};
}

export interface StatisticYAxis {
Expand Down Expand Up @@ -338,9 +342,13 @@ export const getTotalShipStatisticChart = cache(
const series = chartData.series.map((serie) =>
serie.name === "Veränderung zum Vortag"
? {
...serie,
yAxisIndex: 1,
}
...serie,
yAxisIndex: 1,
lineStyle: {
type: "dashed" as const,
width: 1,
},
}
: serie,
);

Expand Down Expand Up @@ -447,9 +455,13 @@ export const getTotalCitizenStatisticChart = cache(
const series = chartData.series.map((serie) =>
serie.name === "Veränderung zum Vortag"
? {
...serie,
yAxisIndex: 1,
}
...serie,
yAxisIndex: 1,
lineStyle: {
type: "dashed" as const,
width: 1,
},
}
: serie,
);

Expand Down Expand Up @@ -559,9 +571,13 @@ export const getTotalOrganizationStatisticChart = cache(
const series = chartData.series.map((serie) =>
serie.name === "Veränderung zum Vortag"
? {
...serie,
yAxisIndex: 1,
}
...serie,
yAxisIndex: 1,
lineStyle: {
type: "dashed" as const,
width: 1,
},
}
: serie,
);

Expand Down Expand Up @@ -673,9 +689,13 @@ export const getRegisteredUserStatisticChart = cache(
const series = chartData.series.map((serie) =>
serie.name === "Veränderung zum Vortag"
? {
...serie,
yAxisIndex: 1,
}
...serie,
yAxisIndex: 1,
lineStyle: {
type: "dashed" as const,
width: 1,
},
}
: serie,
);

Expand Down Expand Up @@ -751,9 +771,13 @@ export const getDailyLoginStatisticChart = cache(
const series = chartData.series.map((serie) =>
serie.name === "Veränderung zum Vortag"
? {
...serie,
yAxisIndex: 1,
}
...serie,
yAxisIndex: 1,
lineStyle: {
type: "dashed" as const,
width: 1,
},
}
: serie,
);

Expand Down Expand Up @@ -843,9 +867,13 @@ export const getEventsPerDayStatisticChart = cache(
const series = chartData.series.map((serie) =>
serie.name === "Veränderung zum Vortag"
? {
...serie,
yAxisIndex: 1,
}
...serie,
yAxisIndex: 1,
lineStyle: {
type: "dashed" as const,
width: 1,
},
}
: serie,
);

Expand Down Expand Up @@ -944,9 +972,13 @@ export const getDailySilcStatisticChart = cache(
const series = chartData.series.map((serie) =>
serie.name === "Veränderung zum Vortag"
? {
...serie,
yAxisIndex: 1,
}
...serie,
yAxisIndex: 1,
lineStyle: {
type: "dashed" as const,
width: 1,
},
}
: serie,
);

Expand Down
Loading