UNPKG

@neo4j-ndl/react-charts

Version:

React implementation of charts from Neo4j Design System

62 lines 2.55 kB
/** * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import type { HexColor } from '../utils/chart-types'; type UseChartLifecycleParams = { palette?: HexColor[]; theme: 'light' | 'dark'; }; type UseChartLoadingParams = { isLoading?: boolean; isWaitingForFirstResize: boolean; theme: 'light' | 'dark'; }; /** * Registers Needle ECharts themes and initializes the chart instance. * * Theme registration runs with the active palette so ECharts can resolve Needle * colors before options are applied. The hook only calls `init` when the DOM * element does not already have an ECharts instance, allowing later renders to * update registered theme data without replacing the existing chart. */ export declare function useChartLifecycle({ palette, theme }: UseChartLifecycleParams): void; /** * Mirrors React loading state into ECharts' loading overlay. * * The overlay also stays visible while the chart waits for its first resize, * preventing users from seeing an unmeasured SVG before ECharts has been sized * to its container. Loading colors come from the active Needle theme. */ export declare function useChartLoading({ isLoading, isWaitingForFirstResize, theme, }: UseChartLoadingParams): void; /** * Keeps the ECharts canvas sized to the DOM box assigned by the chart layout. * * The hook listens to both window resize events and direct element resize * observations because the chart can change size through parent layout changes * that do not emit a window resize. It exposes `isWaitingForFirstResize` so the * rest of the chart can delay rendering dependent UI until ECharts has been * given its initial dimensions. */ export declare function useChartResize(): { isWaitingForFirstResize: boolean; resizeChart: () => void; }; export {}; //# sourceMappingURL=use-chart-instance.d.ts.map