import { CSSProperties } from 'react'; import { ComposeOption, ECharts } from 'echarts/core'; import { LineSeriesOption, BarSeriesOption, PieSeriesOption, FunnelSeriesOption, ScatterSeriesOption, RadarSeriesOption } from 'echarts/charts'; import { ToolboxComponentOption, TitleComponentOption, TooltipComponentOption, DataZoomComponentOption, LegendComponentOption, CalendarComponentOption, GridComponentOption, GraphicComponentOption, PolarComponentOption } from 'echarts/components'; import type { SeriesOption, XAXisOption, YAXisOption, RadarOption, GridOption } from 'echarts/types/dist/shared'; import { EChartsOption } from 'echarts'; export declare type EBaseOption = TitleComponentOption | ToolboxComponentOption | TooltipComponentOption | GraphicComponentOption | LegendComponentOption; export interface IBaseProps { /** * @description 数据集合 * @default */ option?: O; /** * @description 图表工具栏 * @default */ toolbox?: ToolboxComponentOption; /** * @description 图表 title * @default */ title?: TitleComponentOption | string | boolean; /** * @description 提示框组件 * @default */ tooltip?: TooltipComponentOption; /** * @description 图例组件 * @default */ legend?: LegendComponentOption | boolean; /** * @description 图表高度 * @default 350px */ height?: string; /** * @description 调色盘 * @default */ color?: string[]; /** * @description 图表配置项和数据 * @default */ series?: SeriesOption[] | SeriesOption; /** * @description 主题 * @default */ theme?: string; /** * @description 自定义样式 * @default */ style?: CSSProperties; /** * @description 自定义类名 * @default */ className?: string; /** * @description 渲染器 * @default 'canvas' */ renderer?: 'canvas' | 'svg'; } export declare type ELineOption = ComposeOption; export declare type EBarOption = ComposeOption; export declare type EPieOption = ComposeOption; export declare type EFunnelOption = ComposeOption; export declare type EScatterOption = ComposeOption; export declare type EProgressOption = ComposeOption; export declare type ERadarOption = ComposeOption; export interface ILineProps extends IBaseProps { /** * @description 直角坐标系 grid 中的 x 轴 * @default */ xAxis?: XAXisOption | XAXisOption[] | boolean; /** * @description 直角坐标系 grid 中的 y 轴 * @default */ yAxis?: YAXisOption | YAXisOption[] | boolean; } export interface IBarProps extends IBaseProps { /** * @description 直角坐标系 grid 中的 x 轴 * @default */ xAxis?: XAXisOption | XAXisOption[] | boolean; /** * @description 直角坐标系 grid 中的 y 轴 * @default */ yAxis?: YAXisOption | YAXisOption[] | boolean; /** * @description 直角坐标系 grid 配置 * @default */ grid?: GridOption; } export declare type IPieProps = IBaseProps; export declare type IFunnelProps = IBaseProps; export interface IScatterProps extends IBaseProps { /** * @description 直角坐标系 grid 中的 x 轴 * @default */ xAxis?: XAXisOption | XAXisOption[] | boolean; /** * @description 直角坐标系 grid 中的 y 轴 * @default */ yAxis?: YAXisOption | YAXisOption[] | boolean; } export interface IProgressProps extends IBaseProps { /** * @description 图表最大数据 * @default 100 */ max?: number; } export declare type IRadarProps = IBaseProps; export declare type IAxis = XAXisOption | YAXisOption; export declare type IBaseChartProps = ILineProps | IBarProps | IPieProps | IScatterProps | IFunnelProps | IProgressProps | IRadarProps | IBaseProps; export declare type EBaseChartOption = ELineOption | EBarOption | EPieOption | EScatterOption | EFunnelOption | EProgressOption | ERadarOption | EChartsOption; export interface IChartRef { /** * @description 获取 echarts 实例 * @default Echarts */ getInstance: () => ECharts | null; } export interface IWordCloudSeries { name: string; value: number; } export declare type IWordCloudListEntry = [string, number]; export interface IWordCloudDimension { x: number; y: number; w: number; h: number; } export declare type IWordCloudEventCallback = (item: IWordCloudListEntry, dimension: IWordCloudDimension, event: MouseEvent) => void; export interface IWordChartProps { /** * @description 自定义样式 * @default */ style?: CSSProperties; /** * @description 自定义类名 * @default */ className?: string; /** * @description 数据集合 * @default [] */ series?: IWordCloudSeries[]; /** * @description 图表高度 * @default '350px' */ height?: string; /** * @description 背景颜色 * @default */ backgroundColor?: string; /** * @description 用于标记画布可用性的网格大小(以像素为单位,网格大小越大,单词之间的差距越大) * @default 14 */ gridSize?: number; /** * @description 在画布上绘制的最小字体的大小 * @default */ minSize?: number; /** * @description 用背景颜色绘制整个画布,并在开始之前将其视为空的 * @default */ clearCanvas?: boolean; /** * @description 要调用的函数或要乘以列表中每个单词的大小的数字 * @default */ weightFactor?: number | ((weight: number) => number); /** * @description 旋转单词的概率, 将数字设置为 1 以始终旋转 * @default 0.6 */ rotateRatio?: number; /** * @description 强制使用定义数量的角度。 在 -90°/90° 范围内设置等于 2 的值意味着将仅使用 -90、0 或 90 * @default */ rotationSteps?: number; /** * @description 词云形状 * @default 'circle' */ shape?: string | ((theta: number) => number); /** * @description 字体权重,普通,粗体、指定数值或其他 * @default */ fontWeight?: string | number; /** * @description 字体颜色,可任意颜色也可指定颜色 * @default */ color?: string | ((word: string, weight: string | number, fontSize: number, distance: number, theta: number) => string); /** * @description hover 某个单词的回调 * @default */ onHover?: IWordCloudEventCallback; /** * @description click 某个单词的回调 * @default */ onClick?: IWordCloudEventCallback; }