diff --git a/ipi-survey-platform/src/pages/Admin/ValidationReview.jsx b/ipi-survey-platform/src/pages/Admin/ValidationReview.jsx index 7af4932..d3ce8e0 100644 --- a/ipi-survey-platform/src/pages/Admin/ValidationReview.jsx +++ b/ipi-survey-platform/src/pages/Admin/ValidationReview.jsx @@ -5,11 +5,8 @@ import { getSubmissionById } from '@/services/admin/submission'; import apiClient from '@/services/api/apiClient'; import { getBeforePreviousData, getQuarterPeriods } from '@/services/submissions/submissionService'; import { getProductSubmissionHistory } from '@/services/submissions/submissionService'; -import { Chart as ChartJS, CategoryScale, LinearScale, BarElement, LineElement, PointElement, Title, Tooltip, Legend } from 'chart.js'; import { Line } from 'react-chartjs-2'; -// Register ChartJS components -ChartJS.register(CategoryScale, LinearScale, BarElement, LineElement, PointElement, Title, Tooltip, Legend); // Helper function to get months for quarter const getMonthsForQuarter = (quarter, year) => { @@ -387,22 +384,24 @@ const ProductChart = ({ product, establishmentId }) => { return (
-
-

Product Performance Overview

-
- -
-
-
- -
-
-
+
+

+ Product Performance Overview +

+ +
+ {/* min width handled via Tailwind */} +
+
+ +
+
+
+
); }; @@ -949,7 +948,7 @@ const getQuarterYearLabel = (quarter, year) => { const currentLabel = getQuarterYearLabel(currentQuarter, currentYear); // Next Year Forecast -const forecastLabel = getQuarterYearLabel(forecastQuarter, currentYear + 1); +const forecastLabel = getQuarterYearLabel(forecastQuarter, currentYear); // Optional: Previous Forecast (same year usually) // const additionalForecastLabel = getQuarterYearLabel(forecastQuarter, currentYear); @@ -1126,7 +1125,7 @@ const additionalForecastLabel =
-
+ {/*
)} -
-
+
*/} + {/*
{fetchingNextQuarter ? 'Loading...' : 'Show Historical Comparison'} -
+
*/}
{varianceHighlighting && (
diff --git a/ipi-survey-platform/src/utils/chartsetup.js b/ipi-survey-platform/src/utils/chartsetup.js new file mode 100644 index 0000000..a5937b8 --- /dev/null +++ b/ipi-survey-platform/src/utils/chartsetup.js @@ -0,0 +1,27 @@ +// src/utils/chartSetup.js +import { + Chart as ChartJS, + CategoryScale, + LinearScale, + BarElement, + LineElement, + PointElement, + Title, + Tooltip, + Legend, + +} from 'chart.js'; + +ChartJS.register( + CategoryScale, + LinearScale, + BarElement, + LineElement, + PointElement, + Title, + Tooltip, + Legend + +); + + \ No newline at end of file