From b921b729bac8d3803877491caee3d5862fce1947 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Tue, 2 Sep 2025 15:44:35 +0200 Subject: [PATCH] show more appropriate placeholder data --- .../CreationArchiveChart.tsx | 10 ++- .../CreationArchiveChart/placeholderData.ts | 63 +++++++++++++++++++ 2 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 frontend/src/component/insights/componentsChart/CreationArchiveChart/placeholderData.ts diff --git a/frontend/src/component/insights/componentsChart/CreationArchiveChart/CreationArchiveChart.tsx b/frontend/src/component/insights/componentsChart/CreationArchiveChart/CreationArchiveChart.tsx index fdf9fe3f70..12838a7a09 100644 --- a/frontend/src/component/insights/componentsChart/CreationArchiveChart/CreationArchiveChart.tsx +++ b/frontend/src/component/insights/componentsChart/CreationArchiveChart/CreationArchiveChart.tsx @@ -21,11 +21,11 @@ import type { TooltipState } from 'component/insights/components/LineChart/Chart import type { WeekData, RawWeekData } from './types.ts'; import { createTooltip } from 'component/insights/components/LineChart/createTooltip.ts'; import { CreationArchiveRatioTooltip } from './CreationArchiveRatioTooltip.tsx'; -import { Chart } from 'react-chartjs-2'; import { getDateFnsLocale } from '../../getDateFnsLocale.ts'; import { customHighlightPlugin } from 'component/common/Chart/customHighlightPlugin.ts'; import { NotEnoughData } from 'component/insights/components/LineChart/LineChart.tsx'; -import { usePlaceholderData } from 'component/insights/hooks/usePlaceholderData.ts'; +import { placeholderData } from './placeholderData.ts'; +import { Bar } from 'react-chartjs-2'; ChartJS.register( CategoryScale, @@ -74,7 +74,6 @@ export const CreationArchiveChart: FC = ({ }) => { const creationVsArchivedChart = useProjectChartData(creationArchiveTrends); const theme = useTheme(); - const placeholderData = usePlaceholderData(); const { locationSettings } = useLocationSettings(); const [tooltip, setTooltip] = useState(null); @@ -213,7 +212,7 @@ export const CreationArchiveChart: FC = ({ display: false, }, ticks: { - source: 'data', + source: 'data' as const, display: !useGraphCover, }, }, @@ -237,8 +236,7 @@ export const CreationArchiveChart: FC = ({ return ( <> - = { + datasets: [ + { + label: 'Flags archived', + data, + parsing: { + yAxisKey: 'archivedFlags', + xAxisKey: 'date', + }, + order: 1, + }, + { + label: 'Flags created', + data, + parsing: { + yAxisKey: 'totalCreatedFlags', + xAxisKey: 'date', + }, + order: 2, + }, + ], +};