UNPKG

@neo4j-ndl/react-charts

Version:

React implementation of charts from Neo4j Design System

84 lines 3.71 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 EChartsOption, type LineSeriesOption, type RegisteredSeriesOption, type SetOptionOpts } from 'echarts'; import { type CSSProperties } from 'react'; import { type NotificationType } from './ChartTooltip'; import { type LegendProps } from './Legend'; type Condition = 'greater' | 'greaterOrEqual' | 'less' | 'lessOrEqual' | 'equal' | 'notEqual'; type CustomCondition = (lineValue: unknown, thresholdLineValue: unknown) => boolean; export interface ThresholdLineSeriesOption<T extends NotificationType> extends Omit<LineSeriesOption, 'type'> { type: 'thresholdLine'; yAxis: number; xAxis: [number, number]; notificationType: T; color?: string; condition?: Condition; customConditionText?: string; customCondition?: CustomCondition; } export declare const defaultThresholdLineSeriesOption: { condition: Condition; }; export type Values<T> = T[keyof T]; export type SeriesOption = Values<RegisteredSeriesOption>; export type EchartsSeries = SeriesOption | SeriesOption[]; export type NeedleSeries = [ ThresholdLineSeriesOption<'warning'>, ThresholdLineSeriesOption<'danger'>, ...SeriesOption[] ] | [ThresholdLineSeriesOption<'danger'>, ...SeriesOption[]] | [ThresholdLineSeriesOption<'warning'>, ...SeriesOption[]] | SeriesOption[]; interface ChartProps { /** The dataset configuration for the chart. Can be a single dataset or an array of datasets. */ dataset: EChartsOption['dataset']; /** The series configuration for the chart. Defines what data to display and how to display it. */ series: NeedleSeries; /** X-axis configuration for the chart. */ xAxis?: EChartsOption['xAxis']; /** Y-axis configuration for the chart. */ yAxis?: EChartsOption['yAxis']; /** Legend configuration for the chart. */ legend?: { show?: boolean; wrappingType?: LegendProps['wrappingType']; }; /** Additional ECharts options to merge with the chart configuration. */ option?: Omit<EChartsOption, 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'>; /** Custom CSS styles to apply to the chart container. */ style?: CSSProperties; /** Settings for how ECharts should update the chart. */ settings?: SetOptionOpts; /** Whether the chart is in a loading state. */ isLoading?: boolean; /** Callback functions for chart interactions. */ callbacks?: { onZoom?: (params: { startValue: number; endValue: number; }) => void; }; /** Data zoom configuration for the chart. */ dataZoom?: EChartsOption['dataZoom']; /** Whether the zoom in the chart is disabled */ isChartZoomDisabled?: boolean; } export declare function Chart({ dataset, option: userOption, xAxis: propXAxis, yAxis: propYAxis, series: propsSeries, style, settings, isLoading, isChartZoomDisabled, legend, callbacks, }: ChartProps): React.JSX.Element; export {}; //# sourceMappingURL=Chart.d.ts.map