tooltip with latest beta and nextjs #316
Send to my agenthi,
just updated from 2.x and all is good except the tooltips....
here is the barchart code that dynamically imports chart.
thanks, sam
import React from 'react'; import { Flex, useColorMode, Box } from "@chakra-ui/react"; import dynamic from 'next/dynamic';
export const BarChart = ({ chartData, height=350, width='full' }) => {
if (!chartData || chartData.length < 1) { return(null); }
const Chart = dynamic(() => import("react-charts").then((mod) => mod.Chart), { ssr: false, });
const primaryAxis = React.useMemo(() => ({ getValue: datum => datum.primary, }), []);
const secondaryAxes = React.useMemo(() => [ { getValue: datum => datum.secondary, elementType: 'bar', }, ], []);
const data = React.useMemo(() => chartData, [chartData]) const dark = useColorMode().colorMode === 'dark';
return ( <Chart options={{ data: data, primaryAxis, secondaryAxes, dark: dark, }} /> ); }
Also running into the same issue (my tooltip is stuck at [0,0] and doesn't follow the mouse, though the sizing is correct at least), not sure how to tackle it. The brush option is also broken unfortunately. I think it's some internal util to get the correct rect that's failing to get it.
cc: @tannerlinsley
Update: seems to be caused by the move to ResizeObserver (#299 or https://github.com/TanStack/react-charts/commit/6888a17779e6bb0f8372d5f6f55f04b4a23ac4b0, really hard to say without being able to test v3.0.0-beta.39, it won't even launch), I'll try to take a look into useRect and Tooltip.tsx as both received major changes since beta.38 and it has been broken ever since.
This should be fixed in the latest beta. LMK
tannerlinsley closed this
Sign in to join this conversation.
Have a problem here with the alignment of the tooltip.... This is kind of an annoying issue. Even though setting properties inside the tooltip field inside the options object would not resolve the issue sadly.. only when you are setting alignPriority to: ["top", "bottom"] it's only positioning it self vertically which is intended but if you swap them with ["left, "right"] same behaviour occurs