This commit is contained in:
2024-10-16 13:41:39 +05:30
parent e5a8530090
commit 3f9e980677
2 changed files with 4 additions and 3 deletions

View File

@@ -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",

View File

@@ -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 = () => {
<ChartsTabs
setSelectedValue={setSelectedValue}
selectedValue={selectedValue}
days={dayjs().daysInMonth()}
/>
</Box>
<Line data={data} options={options} />