Skip to content

Commit

Permalink
clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Nov 5, 2024
1 parent 257dbec commit afce57b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 21 deletions.
3 changes: 0 additions & 3 deletions web/src/app/ee/admin/performance/usage/DanswerBotChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ export function DanswerBotChart({
categories={["Total Queries", "Automatically Resolved"]}
index="Day"
colors={["indigo", "fuchsia"]}
valueFormatter={(number: number) =>
`${Intl.NumberFormat("us").format(number).toString()}`
}
yAxisWidth={60}
/>
);
Expand Down
3 changes: 0 additions & 3 deletions web/src/app/ee/admin/performance/usage/FeedbackChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ export function FeedbackChart({
categories={["Positive Feedback", "Negative Feedback"]}
index="Day"
colors={["indigo", "fuchsia"]}
valueFormatter={(number: number) =>
`${Intl.NumberFormat("us").format(number).toString()}`
}
yAxisWidth={60}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function QueryPerformanceChart({
categories={["Queries", "Unique Users"]}
index="Day"
colors={["indigo", "fuchsia"]}
valueFormatter={(number: number) =>
yAxisFormatter={(number: number) =>
new Intl.NumberFormat("en-US", {
notation: "standard",
maximumFractionDigits: 0,
Expand All @@ -87,14 +87,6 @@ export function QueryPerformanceChart({
day: "numeric",
});
}}
tooltipFormatter={(dateStr: string) => {
const date = new Date(dateStr);
return date.toLocaleDateString("en-US", {
year: "numeric",
month: "short",
day: "numeric",
});
}}
yAxisWidth={60}
allowDecimals={false}
/>
Expand Down
11 changes: 5 additions & 6 deletions web/src/components/ui/areaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ interface AreaChartProps {
categories?: string[];
index?: string;
colors?: string[];
valueFormatter?: (value: number) => string;
startEndOnly?: boolean;
showXAxis?: boolean;
showYAxis?: boolean;
Expand All @@ -42,17 +41,15 @@ interface AreaChartProps {
className?: string;
title?: string;
description?: string;
xAxisFormatter?: (dateStr: string) => string;
xAxisFormatter?: (value: any) => string;
yAxisFormatter?: (value: any) => string;
}

export function AreaChartDisplay({
data = [],
categories = [],
index,
colors = ["indigo", "fuchsia"],
xAxisFormatter = (dateStr: string) => dateStr,
valueFormatter = (number: number) =>
`${Intl.NumberFormat("us").format(number).toString()}`,
startEndOnly = false,
showXAxis = true,
showYAxis = true,
Expand All @@ -70,6 +67,8 @@ export function AreaChartDisplay({
className,
title,
description,
xAxisFormatter = (dateStr: string) => dateStr,
yAxisFormatter = (number: number) => number.toString(),
}: AreaChartProps) {
return (
<Card className={className}>
Expand Down Expand Up @@ -104,7 +103,7 @@ export function AreaChartDisplay({
width={yAxisWidth}
tickLine={false}
axisLine={false}
tickFormatter={valueFormatter}
tickFormatter={(value) => yAxisFormatter(value)}
allowDecimals={allowDecimals}
/>
)}
Expand Down

0 comments on commit afce57b

Please sign in to comment.