mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-11 05:36:03 +02:00
update
This commit is contained in:
@@ -45,6 +45,7 @@ export function QueryPerformanceChart({
|
|||||||
} else {
|
} else {
|
||||||
const initialDate = timeRange.from || new Date(queryAnalyticsData[0].date);
|
const initialDate = timeRange.from || new Date(queryAnalyticsData[0].date);
|
||||||
const dateRange = getDatesList(initialDate);
|
const dateRange = getDatesList(initialDate);
|
||||||
|
console.log("dateRange", dateRange);
|
||||||
|
|
||||||
const dateToQueryAnalytics = new Map(
|
const dateToQueryAnalytics = new Map(
|
||||||
queryAnalyticsData.map((queryAnalyticsEntry) => [
|
queryAnalyticsData.map((queryAnalyticsEntry) => [
|
||||||
@@ -58,6 +59,8 @@ export function QueryPerformanceChart({
|
|||||||
userAnalyticsEntry,
|
userAnalyticsEntry,
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
// console.log("dateToQueryAnalytics", dateToQueryAnalytics);
|
||||||
|
// console.log("dateToUserAnalytics", dateToUserAnalytics);
|
||||||
|
|
||||||
chart = (
|
chart = (
|
||||||
<AreaChartDisplay
|
<AreaChartDisplay
|
||||||
@@ -75,9 +78,28 @@ export function QueryPerformanceChart({
|
|||||||
index="Day"
|
index="Day"
|
||||||
colors={["indigo", "fuchsia"]}
|
colors={["indigo", "fuchsia"]}
|
||||||
valueFormatter={(number: number) =>
|
valueFormatter={(number: number) =>
|
||||||
`${Intl.NumberFormat("us").format(number).toString()}`
|
new Intl.NumberFormat("en-US", {
|
||||||
|
notation: "standard",
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
}).format(number)
|
||||||
}
|
}
|
||||||
|
xAxisFormatter={(dateStr: string) => {
|
||||||
|
const date = new Date(dateStr);
|
||||||
|
return date.toLocaleDateString("en-US", {
|
||||||
|
month: "short",
|
||||||
|
day: "numeric",
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
tooltipFormatter={(dateStr: string) => {
|
||||||
|
const date = new Date(dateStr);
|
||||||
|
return date.toLocaleDateString("en-US", {
|
||||||
|
year: "numeric",
|
||||||
|
month: "short",
|
||||||
|
day: "numeric",
|
||||||
|
});
|
||||||
|
}}
|
||||||
yAxisWidth={60}
|
yAxisWidth={60}
|
||||||
|
allowDecimals={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -637,22 +637,20 @@ export function SelectorFormField({
|
|||||||
className={maxHeight ? `max-h-[${maxHeight}]` : undefined}
|
className={maxHeight ? `max-h-[${maxHeight}]` : undefined}
|
||||||
container={container}
|
container={container}
|
||||||
>
|
>
|
||||||
{options.length == 0 && (
|
{options.length === 0 ? (
|
||||||
<SelectItem value="default">Select...</SelectItem>
|
<SelectItem value="default">Select...</SelectItem>
|
||||||
|
) : (
|
||||||
|
options.map((option) => (
|
||||||
|
<SelectItem
|
||||||
|
icon={option.icon}
|
||||||
|
key={option.value}
|
||||||
|
value={String(option.value)}
|
||||||
|
selected={field.value === option.value}
|
||||||
|
>
|
||||||
|
{option.name}
|
||||||
|
</SelectItem>
|
||||||
|
))
|
||||||
)}
|
)}
|
||||||
{defaultValue && (
|
|
||||||
<SelectItem value={defaultValue}>{defaultValue}</SelectItem>
|
|
||||||
)}
|
|
||||||
{options.map((option) => (
|
|
||||||
<SelectItem
|
|
||||||
icon={option.icon}
|
|
||||||
key={option.value}
|
|
||||||
value={String(option.value)}
|
|
||||||
selected={field.value === option.value}
|
|
||||||
>
|
|
||||||
{option.name}
|
|
||||||
</SelectItem>
|
|
||||||
))}
|
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
)}
|
)}
|
||||||
</Select>
|
</Select>
|
||||||
|
@@ -42,6 +42,7 @@ interface AreaChartProps {
|
|||||||
className?: string;
|
className?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
xAxisFormatter?: (dateStr: string) => string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AreaChartDisplay({
|
export function AreaChartDisplay({
|
||||||
@@ -49,6 +50,7 @@ export function AreaChartDisplay({
|
|||||||
categories = [],
|
categories = [],
|
||||||
index,
|
index,
|
||||||
colors = ["indigo", "fuchsia"],
|
colors = ["indigo", "fuchsia"],
|
||||||
|
xAxisFormatter,
|
||||||
valueFormatter = (number: number) =>
|
valueFormatter = (number: number) =>
|
||||||
`${Intl.NumberFormat("us").format(number).toString()}`,
|
`${Intl.NumberFormat("us").format(number).toString()}`,
|
||||||
startEndOnly = false,
|
startEndOnly = false,
|
||||||
@@ -94,7 +96,7 @@ export function AreaChartDisplay({
|
|||||||
tickLine={false}
|
tickLine={false}
|
||||||
axisLine={false}
|
axisLine={false}
|
||||||
tickMargin={8}
|
tickMargin={8}
|
||||||
tickFormatter={(value) => value.slice(0, 3)}
|
tickFormatter={(value) => xAxisFormatter?.(value) || value}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{showYAxis && (
|
{showYAxis && (
|
||||||
|
Reference in New Issue
Block a user