Repository navigation
Tootltip doesnot contains all label. #12050
Replies: 1 comment
|
Add const chartOptions: ChartOptions<"bar"> = {
responsive: true,
maintainAspectRatio: false,
interaction: {
mode: "index",
axis: "x",
intersect: false,
},
// Keep your existing scales, plugins, and layout here.
};Keep your existing This fits your data construction: every subscription's
References: index interaction mode, tooltip selection options. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have created a Component that takes a prop type of
type TOrgChargerInstSubsDataApiRespData = { monthAndYear: string; organizationChargersInstallationSubscriptionHistory: { numberOfChargers: number; installationSubscriptionName: string | null; numberOfActiveChargers: number; numberOfInactiveChargers: number; }[]; }and show the chart based on the data. I wanted a stacked bar chart.
Bars are working properly but when i hover on a bar i am only able to see one label instead of multiple
this is the whole component code.
`"use client";
import { useEffect, useRef } from "react";
import { useParams } from "next/navigation";
import { ChartConfiguration, ChartData, ChartOptions } from "chart.js/auto";
import dayjs from "dayjs";
import { useForm } from "react-hook-form";
import { getDictionary } from "@/app/dictionaries";
import { SelectInput } from "@/components/formControls/SelectInput";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/Card";
import { Form, FormControl, FormField, FormItem, FormMessage } from "@/components/ui/Form";
import { useChart } from "@/hooks/useChart";
import { TOrgChargerInstSubsDataApiRespData } from "@/schema/organization/installationSchema";
import { TOptionType } from "@/typings";
import { BAR_CHART_COLORS } from "@/utils/constants";
import { createUniqueColorPicker, generateRandomColor } from "@/utils/helpers";
interface Props {
chargerInstSubsData: TOrgChargerInstSubsDataApiRespData[];
}
export function OrgChargerStatusDistributionChart({ chargerInstSubsData }: Props) {
const chartRef = useRef(null);
const { lang } = useParams();
const { common, glossary } = getDictionary(lang as string, ["common", "glossary"]);
const form = useForm<{
orgChargerStatusDistributionDataType: "allChargers" | "activeChargers" | "inactiveChargers";
}>({
defaultValues: {
orgChargerStatusDistributionDataType: "allChargers",
},
mode: "onChange",
});
}
`
the tooltip should contains data like this
All reactions