From e5a85300908ab76c1acf889808b5d340a220018d Mon Sep 17 00:00:00 2001 From: "Siddhesh.More" Date: Wed, 16 Oct 2024 13:36:38 +0530 Subject: [PATCH 1/2] update --- src/components/Doughnut/LineChart.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Doughnut/LineChart.jsx b/src/components/Doughnut/LineChart.jsx index 2accbd7..fc29526 100644 --- a/src/components/Doughnut/LineChart.jsx +++ b/src/components/Doughnut/LineChart.jsx @@ -27,7 +27,7 @@ ChartJS.register( const LineChart = () => { const { colorMode } = useColorMode(); - const [selectedValue, setSelectedValue] = useState("Daily"); + const [selectedValue, setSelectedValue] = useState("24 Hrs"); const [labels, setLabels] = useState([]); const [dataset, setDataset] = useState([]); From 3f9e98067751a4deef2cae6216178d9e452511e4 Mon Sep 17 00:00:00 2001 From: "Siddhesh.More" Date: Wed, 16 Oct 2024 13:41:39 +0530 Subject: [PATCH 2/2] update --- src/components/ChartsTabs.jsx | 4 ++-- src/components/Doughnut/LineChart.jsx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/ChartsTabs.jsx b/src/components/ChartsTabs.jsx index df60020..663cb47 100644 --- a/src/components/ChartsTabs.jsx +++ b/src/components/ChartsTabs.jsx @@ -10,7 +10,7 @@ import { } from "@chakra-ui/react"; import { TbArrowBadgeRightFilled } from "react-icons/tb"; -function ChartsTabs({ selectedValue, setSelectedValue }) { +function ChartsTabs({ selectedValue, setSelectedValue, days }) { const { colorMode } = useColorMode(); // This function represents the RadioCard part @@ -49,7 +49,7 @@ function ChartsTabs({ selectedValue, setSelectedValue }) { } // Setting defaultValue to '24 DayusHrs' - const options = ["24 Hrs", "30 Days", "12 Months"]; + const options = ["24 Hrs", `${days} Days`, "12 Months"]; const { getRootProps, getRadioProps } = useRadioGroup({ name: "framework", diff --git a/src/components/Doughnut/LineChart.jsx b/src/components/Doughnut/LineChart.jsx index fc29526..c57a9fe 100644 --- a/src/components/Doughnut/LineChart.jsx +++ b/src/components/Doughnut/LineChart.jsx @@ -41,7 +41,7 @@ const LineChart = () => { Math.floor(Math.random() * 5000 + 1000) ); setDataset(dailyData); - } else if (selectedValue === "30 Days") { + } else if (selectedValue === `${dayjs().daysInMonth()} Days`) { // Create labels for the current month (days) const daysInMonth = dayjs().daysInMonth(); const days = Array.from( @@ -167,6 +167,7 @@ const LineChart = () => {