import { Chart } from '@antv/g2'; import EE from '@antv/event-emitter'; import { Element as Element_2 } from '@antv/g2'; import * as G2 from '@antv/g2'; import { Geometry } from '@antv/g2'; import { ScaleConfig } from '@antv/g2'; import { ShapeAttrs } from '@antv/g-base'; import { ShapeAttrs as ShapeAttrs_2 } from '@antv/g2'; import { Types } from '@antv/g2'; import { View } from '@antv/g2'; /** * schema 转 G2 的适配器基类 * 使用 纯函数的方式,这里只是类型定义 */ export declare type Adaptor = (params: Params) => void; export declare const adaptors: { scale: typeof scale; legend: typeof legend; tooltip: typeof tooltip; annotation: typeof annotation; interaction: typeof interaction; theme: typeof theme; animation: typeof animation; }; /** * 动画 * @param params */ declare function animation>(params: Params): Params; declare type Animation_2 = false | Types.AnimateOption; export declare type Annotation = { id?: string; } & AnnotationOption; /** * annotation 配置 * @param params */ declare function annotation(annotationOptions?: Options['annotations']): >(params: Params) => Params; declare type AnnotationOption = Types.ArcOption | Types.ImageOption | Types.LineOption | Types.TextOption | Types.RegionOption | Types.RegionFilterOption | Types.DataMarkerOption | Types.DataRegionOption | Types.ShapeAnnotationOption | Types.HtmlAnnotationOption; /** annotation position */ export declare type AnnotationPosition = Types.AnnotationPosition; export declare class Area extends Plot { /** * 获取 面积图 默认配置项 * 供外部使用 */ static getDefaultOptions(): Partial; /** 图表类型 */ type: string; /** * 获取 面积图 默认配置 */ protected getDefaultOptions(): Partial; /** * @override * @param data */ changeData(data: AreaOptions['data']): void; /** * 获取 面积图 的适配器 */ protected getSchemaAdaptor(): Adaptor; } /** * area geometry 的配置处理 * @param params */ export declare function area(params: Params): Params; export declare interface AreaGeometryOptions extends GeometryOptions { /** x 轴字段 */ readonly xField?: string; /** y 轴字段 */ readonly yField?: string; /** 分组字段 */ readonly seriesField?: string; /** 是否平滑 */ readonly smooth?: boolean; /** area 图形的样式设置 */ readonly area?: MappingOptions; } /** 面积图的配置类型定义 */ export declare interface AreaOptions extends Options, Pick { /** * @title x轴字段 */ readonly xField?: string; /** * @title y轴字段 */ readonly yField?: string; /** * @title 分组字段 */ readonly seriesField?: string; /** * @title 是否配置堆积 * @default false */ readonly isStack?: boolean; /** * @title 是否配置百分比 * @default false */ readonly isPercent?: boolean; /** * @title 是否配置平滑 * @default false */ readonly smooth?: boolean; /** * @title 面积图形样式 */ readonly areaStyle?: StyleAttr; /** * @title 面积中折线的样式 */ readonly line?: LineGeometryOptions['line'] & Pick; /** * @title 面积图数据点图形样式 */ readonly point?: PointGeometryOptions['point'] & Pick; /** * @title 面积图填充 * @description 面积图是否从 0 基准线开始填充 * @default false */ readonly startOnZero?: boolean; /** * @title 坐标转换 * @description 可以对坐标系进行转换,如: reflectX, reflectY, transpose 等 */ readonly coordinate?: Transformations; } export declare type Axis = false | (Types.AxisCfg & Omit); /** * 条形图 */ export declare class Bar extends Plot { /** * 获取 条形图 默认配置项 * 供外部使用 */ static getDefaultOptions(): Partial; /** 图表类型 */ readonly type: string; /** * @override */ changeData(data: BarOptions['data']): void; /** * 获取 条形图 默认配置 */ protected getDefaultOptions(): Partial; /** * 获取 条形图 的适配器 */ protected getSchemaAdaptor(): Adaptor; } export declare interface BarOptions extends Omit { /** * @title 柱状图柱子样式配置 */ readonly barStyle?: ColumnOptions['columnStyle']; /** * @title 柱状图宽度占比 * @description 范围[0-1] */ readonly barWidthRatio?: ColumnOptions['columnWidthRatio']; /** * @title 条形图最小宽度(像素) */ readonly minBarWidth?: ColumnOptions['minColumnWidth']; /** * @title 条形图最大宽度(像素) */ readonly maxBarWidth?: ColumnOptions['maxColumnWidth']; /** * @title 条形图柱子的背景配置 */ readonly barBackground?: ColumnOptions['columnBackground']; } /** 位置 */ export declare type BBox = { readonly x: number; readonly y: number; readonly width: number; readonly height: number; }; /** brush 交互 */ export declare type BrushCfg = { /** * @title 是否启用 * @description 是否启用 brush 交互 */ readonly enabled?: boolean; /** * @title brush 类型 * @description '矩形', 'x 方向' 和 'y 方向', 'circle', 'path'(不规则矩形). 默认: 'rect'. * @default "rect" */ readonly type?: 'rect' | 'x-rect' | 'y-rect' | 'circle' | 'path'; /** * @title brush 操作 * @description '筛选过滤' 和 '高亮强调'. 默认: 'filter'. 目前只在 type 为 'rect' 的情况下生效 * @default "filter" */ readonly action?: 'filter' | 'highlight'; /** * @title mask * @description brush mask 的配置 */ readonly mask?: { /** * @title mask 样式 * @description mask 蒙层样式 */ style?: ShapeAttrs_2; }; /** * @title button 配置 * @description brush button 的配置, 只在 action: 'filter' 的情况下适用 */ readonly button?: ButtonCfg; /** * @title 是否允许 brush 交互开始的回调 * @description 是否允许 brush 交互开始的回调 */ readonly isStartEnable?: (context: any) => boolean; }; export declare class Bullet extends Plot { /** * 获取 子弹图 默认配置项 * 供外部使用 */ static getDefaultOptions(): Partial; /** 图表类型 */ type: string; changeData(data: any): void; /** * 获取子弹图的适配器 */ protected getSchemaAdaptor(): Adaptor; /** * 获取 子弹图 默认配置 */ protected getDefaultOptions(): Partial; } declare type BulletAttr = { measure?: T; target?: T; range?: T; }; export declare interface BulletOptions extends Omit { /** * @title 弹图标题 * @description 用于区分不同的类型 */ readonly xField?: string; /** * @title 测量字段 * @description 使用数据条的长度,表示实际数值字段,所表示值为 number[] */ readonly measureField: string; /** * @title 范围字段 * @description 使用背景色条的长度,表示区间范围 [20,50,100], 所表示值为 number[] */ readonly rangeField: string; /** * @title 目标字段 * @description 使用测量标记的刻度轴位置,表示目标值,所表示值为数值 */ readonly targetField: string; /** * @title 标签 * @description 包含了 measure,target,range */ readonly label?: BulletAttr; /** * @title 尺寸 * @description 包含了 measure,target,range */ readonly size?: BulletAttr; /** * @title 颜色 * @description 包含了 measure,target,range */ readonly color?: BulletAttr; /** * @title 项目符号样式 * @description 包含了 measure,target,range */ readonly bulletStyle?: BulletAttr; /** * @title 布局方向选择 * @default "horizontal" */ layout?: 'horizontal' | 'vertical'; } /** * @description 一些按钮的类型定义,比如 brush filter 中的 Button * * 和 GUI Button 尽量保持一致 */ export declare type ButtonCfg = { /** * @title 间距 * @description 文本与按钮边缘的间距 */ padding?: number | number[]; /** * @title 文本 * @description 按钮文本 */ text?: string; /** * @title 文本样式 * @title 自定义文本样式 */ textStyle?: { default?: ShapeAttrs_2; }; /** * @title 按钮样式 * @description 自定义按钮样式 */ buttonStyle?: { default?: ShapeAttrs_2; active?: ShapeAttrs_2; }; }; /** 颜色映射 */ export declare type ColorAttr = string | string[] | ((datum: Datum, defaultColor?: string) => string); /** * 柱形图 */ export declare class Column extends Plot { /** * 获取 柱形图 默认配置项 * 供外部使用 */ static getDefaultOptions(): Partial; /** 图表类型 */ readonly type: string; /** * @override */ changeData(data: ColumnOptions['data']): void; /** * 获取 柱形图 默认配置 */ protected getDefaultOptions(): Partial; /** * 获取 柱形图 的适配器 */ protected getSchemaAdaptor(): Adaptor; } export declare interface ColumnOptions extends Options, OptionWithConversionTag, OptionWithConnectedArea, PartialIntervalGeometryOptions { /** * @title x轴字段 */ readonly xField: string; /** * @title y轴字段 */ readonly yField: string; /** * @title 拆分字段 */ readonly seriesField?: string; /** * @title 是否分组柱形图 * @default false */ readonly isGroup?: boolean; /** * @title 是否是区间柱状图 * @default false */ readonly isRange?: boolean; /** * @title 是否是百分比柱状图 * @default false */ readonly isPercent?: boolean; /** * @title 是否堆积柱状图 * @default false */ readonly isStack?: boolean; /** * @title 柱状图宽度占比 * @description 范围[0-1] */ readonly columnWidthRatio?: number; /** * @title 分组中柱子之间的间距 * @description 范围[0-1],仅对分组柱状图适用 */ readonly marginRatio?: number; /** * @title 柱状图最小宽度(像素) */ readonly minColumnWidth?: number; /** * @title 柱状图最大宽度(像素) */ readonly maxColumnWidth?: number; /** * @title 柱状图柱子的背景 */ readonly columnBackground?: { style?: ShapeAttrs_2; }; /** * @title 柱子样式 */ readonly columnStyle?: StyleAttr; /** * @title 分组字段 * @description 优先级高于 seriesField , isGroup: true 时会根据 groupField 进行分组 */ readonly groupField?: string; /** * @title 自定义柱状图 * @description interval 图形元素展示形状 */ readonly shape?: string; /** * @title 图表交互 * @description 开启下钻交互,以及进行下钻交互的配置 */ readonly brush?: BrushCfg; /** * @title 坐标转换 * @description 可以对坐标系进行转换,如: reflectX, reflectY, transpose 等 */ readonly coordinate?: Transformations; } declare interface ConnectedAreaOptions { /** 触发方式, 默认 hover */ trigger?: 'hover' | 'click'; /** 自定义样式 */ style?: ShapeAttrs_2 | ((style: ShapeAttrs_2, element: Element_2) => ShapeAttrs_2); } /** 转化率组件配置选项 */ declare interface ConversionTagOptions { /** tag 高度 */ size?: number; /** tag 对柱子间距 */ spacing?: number; /** tag 距离轴线距离 */ offset?: number; /** 箭头形状配置 */ arrow?: { /** 箭头宽度 */ headSize?: number; /** 箭头样式 */ style?: ShapeAttrs_2; } | false; /** 文本配置 */ text?: { /** 文字大小 */ size?: number; /** 文字样式 */ style?: ShapeAttrs_2; /** 文本格式化 */ formatter?: (prev: number, next: number) => string; } | false; } declare type CSSStyle = Omit, 'opacity' | 'fontWeight' | 'lineHeight'> & { /** * @title 透明度 */ opacity?: number; /** * @title 字体粗细程度 */ fontWeight?: string | number; /** * @title 行高 */ lineHeight?: string | number; }; /** 一个数据序列 */ export declare type Data = Datum[]; /** 一条数据记录 */ export declare type Datum = Record; /** * @title dot pattern */ declare type DotPatternCfg = PatternCfg & { /** * @title 点的大小 * @default 4 */ size?: number; /** * @title 点间距 * @default 4 */ padding?: number; /** * @title 是否交错 * @default true */ isStagger?: boolean; }; /** * 类似 lodash.flow 的方法 * @param flows */ export declare function flow

(...flows: FlowFunction

[]): FlowFunction

; declare type FlowFunction

= (param: P) => P; declare type FontWeight = ShapeStyle['fontWeight']; export declare class Funnel extends Plot { /** 图表类型 */ type: string; static getDefaultOptions(): Partial; /** 漏斗 转化率 字段 */ static CONVERSATION_FIELD: string; /** 漏斗 百分比 字段 */ static PERCENT_FIELD: string; /** 漏斗 总转换率百分比 字段 */ static TOTAL_PERCENT_FIELD: string; /** * 获取 漏斗图 默认配置项 */ protected getDefaultOptions(): Partial; /** * 获取 漏斗图 的适配器 */ protected getSchemaAdaptor(): Adaptor; /** * 设置状态 * @param type 状态类型,支持 'active' | 'inactive' | 'selected' 三种 * @param conditions 条件,支持数组 * @param status 是否激活,默认 true */ setState(type: StateName, condition: StateCondition, status?: boolean): void; /** * 获取状态 */ getStates(): StateObject[]; } export declare const FUNNEL_CONVERSATION_FIELD = "$$conversion$$"; export declare interface FunnelOptions extends Options { /** * @title x轴字段 */ readonly xField?: string; /** * @title y轴字段 */ readonly yField?: string; /** * @title 分组字段 * @description 漏斗图将根据此字段转置为分面漏斗图 */ readonly seriesField?: string; /** * @title 对比字段 * @description 漏斗图将根据此字段转置为对比漏斗图 */ readonly compareField?: string; /** * @title 是否转置 * @default false */ readonly isTransposed?: boolean; /** * @title 是否是动态高度 * @default false */ readonly dynamicHeight?: boolean; /** * @title 最大宽度 * @description 范围0-1 */ readonly maxSize?: number; /** * @title 最小宽度 * @description 范围0-1 */ readonly minSize?: number; /** * @title shape 形状 * @description pyramid 金字塔, 只在基础漏斗图中适用. 在对比漏斗图以及设置 dynamicHeight: 'true' 时不适用 */ readonly shape?: string; /** * @title 漏斗图样式 */ readonly funnelStyle?: StyleAttr; /** * @title 漏斗分面标题 * @description 是否关闭漏斗的标题展示,适用于存在多组漏斗的情形,如:分组漏斗图、对比漏斗图。 */ readonly showFacetTitle?: boolean; /** * @title 转化率信息 */ readonly conversionTag?: false | { readonly offsetX?: number; readonly offsetY?: number; readonly style?: TextStyle; readonly formatter?: string | ((datum?: Datum, data?: Data) => string); }; } export { G2 } /** * 仪表盘 */ export declare class Gauge extends Plot { /** * 获取 仪表盘 默认配置项 * 供外部使用 */ static getDefaultOptions(): Partial; /** 图表类型 */ type: string; /** * 更新数据 * @param percent */ changeData(percent: number): void; /** * 获取默认配置 * 供 base 使用 */ protected getDefaultOptions(): Partial; /** * 获取适配器 */ protected getSchemaAdaptor(): Adaptor; } /** * @title 仪表盘配置类型定义 */ export declare interface GaugeOptions extends Omit { /** * @title 指标的比例 * @description 范围0 ~ 1 */ readonly percent: number; /** * @title 外弧度 * @description 范围0 ~ 1 */ readonly radius?: number; /** * @title 内弧度 * @description 范围0 ~ 1 */ readonly innerRadius?: number; /** * @title 弧度起始 */ readonly startAngle?: number; /** * @title 弧度结束 */ readonly endAngle?: number; /** * @title 辅助的 range 组件 */ readonly range?: Range_2; /** * @title 坐标轴配置 */ readonly axis?: Axis; /** * @title 指针的配置 */ readonly indicator?: false | Indicator; /** * @title 统计文本 */ readonly statistic?: Statistic; /** * @title 仪表盘样式 */ readonly gaugeStyle?: StyleAttr; /** * @title meter gauge 相关配置 */ /** * @title 仪表盘类型 * @description 可选项: 'meter', default 为空 */ readonly type?: string; /** * @title 仪表盘配置 * @description 当仪表盘类型 = 'meter' 生效 */ readonly meter?: { /** * @title 仪表盘总步数 * @default "50" */ readonly steps?: number; /** * @title step 与 gap 的宽度占比 * @default "0.5" */ readonly stepRatio?: number; }; } /** * 一个图形映射的逻辑,纯粹的图形语法 * // TODO 后续需要处理 adjust 的配置,然后通过 field 信息。比如 styleField,labelField 等一定是一个数组形式 */ declare type Geometry_2 = { /** geometry 类型, 'line' | 'interval' | 'point' | 'area' | 'polygon' */ readonly type?: string; /** x 轴字段 */ readonly xField?: string; /** y 轴字段 */ readonly yField?: string; /** 分组字段 */ readonly colorField?: string; /** shape 的映射字段 */ readonly shapeField?: string; /** size 映射字段 */ readonly sizeField?: string; /** style 的映射字段 */ readonly styleField?: string; /** tooltip 的映射字段 */ readonly tooltipFields?: string[] | false; /** 其他原始字段, 用于 mapping 回调参数 */ readonly rawFields?: RawFields; /** 图形映射规则 */ readonly mapping?: MappingOptions; /** label 映射通道,因为历史原因导致实现略有区别 */ readonly label?: Label; /** 不同状态的样式 */ readonly state?: State; /** 自定义信息,一般在 registerShape 中使用 */ readonly customInfo?: any; /** geometry params */ readonly args?: any; }; declare type GeometryLabelAttr = Types.GeometryLabelCfg | ((datum: Datum) => Types.GeometryLabelCfg); /** * geometry options */ declare type GeometryOptions = Geometry_2 & Partial; /** * 获取内置的 CanvasPattern 方法 * @param options * @returns */ export declare function getCanvasPattern(options: PatternOption): CanvasPattern | undefined; /** 指标指标的配置 */ declare type Indicator = { /** * @title 指针 * @description 只允许静态的 object */ readonly pointer?: { readonly style?: ShapeStyle; }; /** * @title 圆环 * @description 只允许静态的 object */ readonly pin?: { readonly style?: ShapeStyle; }; /** * @title 自定义指针 shape * @default 'gauge-indicator' */ readonly shape?: string; }; export declare type Interaction = { readonly type: string; readonly cfg?: Record; /** 是否开启交互, 默认开启 */ readonly enable?: boolean; }; /** * Interaction 配置 * @param params */ declare function interaction>(params: Params): Params; export declare function interval(params: Params): Params; export declare interface IntervalGeometryOptions extends GeometryOptions { /** x 轴字段 */ readonly xField: string; /** y 轴字段 */ readonly yField: string; /** 拆分字段,在分组柱状图下同 groupField、colorField,在堆积柱状图下同 stackField、colorField */ readonly seriesField?: string; /** 是否分组柱形图 */ readonly isGroup?: boolean; /** 是否堆积柱状图 */ readonly isStack?: boolean; /** 柱状图宽度占比 [0-1] */ readonly widthRatio?: number; /** 分组间柱子之间的组间间距(像素级),仅对分组柱状图适用 */ readonly intervalPadding?: number; /** 分组中柱子之间的间距 [0-1],仅对分组柱状图适用 */ readonly marginRatio?: number; /** 分组中柱子之间的组内间距(像素级),仅对分组柱状图适用 */ readonly dodgePadding?: number; /** 柱状图最小宽度(像素) */ readonly minColumnWidth?: number; /** 柱状图最大宽度(像素) */ readonly maxColumnWidth?: number; /** 柱子的背景样式设置 */ readonly columnBackground?: { style: ShapeAttrs_2; }; /** 柱子视觉通道配置(含 color、shape、size、style、tooltip) */ readonly interval?: MappingOptions; /** 分组字段,优先级高于 seriesField , isGroup: true 时会根据 groupField 进行分组。*/ readonly groupField?: string; } declare type Label = false | ({ /** * @title 映射的字段 */ readonly fields?: string[]; /** * @title 回调函数 * @description 回调函数,返回相关点 value */ readonly callback?: Types.LabelCallback; /** * @title 格式化 * @description 功能同 content ,兼容 v1,一般用于自定义。 */ readonly formatter?: Types.GeometryLabelCfg['content']; } & Types.GeometryLabelCfg); declare interface Labels extends Omit { position?: AnnotationPosition; } declare type Legend = false | Types.LegendCfg; /** * 通用 legend 配置, 适用于带 colorField 或 seriesField 的图表 * @param params */ declare function legend & { colorField?: string; seriesField?: string; }>(params: Params): Params; export declare class Line extends Plot { /** * 获取 折线图 默认配置项 * 供外部使用 */ static getDefaultOptions(): Partial; /** 图表类型 */ type: string; /** * @override * @param data */ changeData(data: LineOptions['data']): void; /** * 获取 折线图 默认配置 */ protected getDefaultOptions(): Partial; /** * 获取 折线图 的适配器 */ protected getSchemaAdaptor(): Adaptor; } /** * line 辅助点的配置处理 * @param params */ export declare function line(params: Params): Params; export declare interface LineGeometryOptions extends GeometryOptions { /** x 轴字段 */ readonly xField?: string; /** y 轴字段 */ readonly yField?: string; /** 分组字段 */ readonly seriesField?: string; /** 是否平滑 */ readonly smooth?: boolean; /** 是否连接空数据 */ readonly connectNulls?: boolean; /** line 映射配置 */ readonly line?: MappingOptions; /** 阶梯折线图类型 */ readonly stepType?: string; } export declare interface LineOptions extends Options, Pick { /** * @title 阶梯折线图类型 */ readonly stepType?: string; /** * @title x轴字段 */ readonly xField?: string; /** * @title y轴字段 */ readonly yField?: string; /** * @title 分组字段 */ readonly seriesField?: string; /** * @title 是否堆积 * @default false */ readonly isStack?: boolean; /** * @title 是否平滑 * @default false */ readonly smooth?: boolean; /** * @title 是否连接空数据 * @default false */ readonly connectNulls?: boolean; /** * @title 折线图形样式 */ readonly lineStyle?: StyleAttr; /** * @title 折线 shape 配置 */ readonly lineShape?: Required['line']['shape']; /** * @title 折线数据点 * @description 1、图形映射属性 2、状态样式 */ readonly point?: PointGeometryOptions['point'] & Pick; /** * @title 折线趋势填充色 * @description 1、图形映射属性 */ readonly area?: AreaGeometryOptions['area'] & Pick; /** * @title 坐标轴反转配置 * @description 坐标轴反转配置 'x' | 'y' | ['x', 'y'] */ readonly reflect?: 'x' | 'y' | ['x', 'y']; } /** * @title line pattern */ declare type LinePatternCfg = PatternCfg & { /** * @title 线之间的距离 */ spacing?: number; }; export declare type Locale = { locale: string; general: { increase: string; decrease: string; root: string; }; /** 中心文本 */ statistic: { total: string; }; /** 转化率组件 */ conversionTag: { label: string; }; legend?: Record; tooltip?: Record; slider?: Record; scrollbar?: Record; waterfall: { /** 总计或累计值 */ total: string; }; }; /** * 图形映射属性,按照优先级来的 */ declare type MappingOptions = { /** color 映射 */ readonly color?: ColorAttr; /** shape 映射 */ readonly shape?: ShapeAttr; /** 大小映射, 提供回调的方式 */ readonly size?: SizeAttr; /** 样式映射 */ readonly style?: StyleAttr; /** tooltip 映射 */ readonly tooltip?: TooltipAttr; }; /** * 计算文本在画布中的宽度 * @param text 文本 * @param font 字体 */ export declare const measureTextWidth: { (...args: any[]): any; cache: Map; }; /** scale 元信息,取名为 meta */ export declare type Meta = ScaleConfig & { /** * @title mescale 的 type 类型ta * @description 对于连续的,一般是 linear,对于分类一般为 cat。当然也有 log, pow, time 等类型,或者通过 tickMethod 自定义自己的 scale */ readonly type?: string; /** * @title 是否进行 scale 的同步 * @description 设置为 false 则不同步; 设置为 true 则以 field 为 key 进行同步;设置为 string,则以这个 string 为 key 进行同步 */ readonly sync?: boolean | string; }; /** 基础的 Options 配置 */ export declare type Options = { /** * @title 画布宽度 */ readonly width?: number; /** * @title 画布高度 */ readonly height?: number; /** * @title 自适应 * @description 画布是否自动适配容器大小,默认为 true */ readonly autoFit?: boolean; /** * @title 内填充 * @description 画布的 padding 值,或者开启 'auto' */ readonly padding?: number[] | number | 'auto'; /** * @title 画布宽度 * @description 额外怎加的 padding 值 */ readonly appendPadding?: number[] | number; /** * @title 额外填充 * @description 是否同步子 view 的 padding */ readonly syncViewPadding?: boolean | Types.SyncViewPaddingFn; /** * @title 国际化 * @description 语言配置 */ readonly locale?: string; /** * @title 渲染引擎 * @description 设置渲染引擎,'svg' | 'canvas' * @default "canvas" */ readonly renderer?: 'svg' | 'canvas'; /** * @title 屏幕像素比 * @description 默认为 window.devicePixelRatio */ readonly pixelRatio?: number; /** * @title 是否启局部渲染 * @description 是否开启局部渲染,默认为 true * @default true */ readonly localRefresh?: boolean; /** * @title 是否支持 CSS transform * @description 开启后图表的交互以及事件将在页面设置了 css transform 属性时生效,默认关闭。 * @default false */ readonly supportCSSTransform?: boolean; /** * @title 是否开启 label 延迟渲染 * @description 开启后 label 渲染会在浏览器空闲时机执行。可制定具体 number 数值,来限定 timeout 时间 (建议开启时,指定 timeout 时间) * @default false */ readonly useDeferredLabel?: boolean | number; /** * @title 数据 * @description 设置画布具体的数据 */ readonly data: Record[]; /** * @title 数据字段元信息 * @description 设置数据字段元信息 */ readonly meta?: Record; /** * @title 主题 * @description G2 主题,字符串或者 theme object * @default "light" */ readonly theme?: string | object; /** * @title 颜色色板 * @description 设置颜色色板 */ readonly color?: ColorAttr; /** * @title pattern 配置 * @description 设置图表 pattern */ readonly pattern?: PatternAttr; /** * @title 横坐标 * @description 设置画布横坐标的配置项 */ readonly xAxis?: Axis; /** * @title 纵坐标 * @description 设置画布纵坐标的配置项 */ readonly yAxis?: Axis; /** * @title 数据标签 * @description 设置数据标签 */ readonly label?: Label; /** * @title tooltip 提示 * @description 设置画布 tooltip 的配置项 */ readonly tooltip?: Tooltip; /** * @title 图例 * @description 设置画布图例 legend 的配置项 */ readonly legend?: Legend; /** * @title 缩略轴 * @description 设置缩略轴 slider 的配置项 */ readonly slider?: Slider; /** * @title 滚动条 * @description 设置画布缩略轴 scrollbar 的配置项 */ readonly scrollbar?: Scrollbar; /** * @title 动画 * @description 设置图表动画 */ readonly animation?: Animation_2 | ((type: string, g: Geometry) => Animation_2) | boolean; /** * @title 交互 * @description 设置画布交互行为 */ readonly interactions?: Interaction[]; /** * @title 注解 * @description 设置画布注解 */ readonly annotations?: Annotation[]; /** * @title 图表状态 * @description 设置画布配置 active,inactive,selected 三种状态的样式,也可在 Theme 主题中配置 */ readonly state?: State; /** * @title 是否裁剪 * @description 是否对超出坐标系范围的 Geometry 进行剪切 */ readonly limitInPlot?: boolean; /** * @title 内置交互 * @description 内置注册的交互 * @deprecated false */ readonly defaultInteractions?: string[]; }; /** 联通区域组件:使用于堆叠柱形图、堆叠条形图 */ declare interface OptionWithConnectedArea { connectedArea?: ConnectedAreaOptions | false; } declare interface OptionWithConversionTag { conversionTag?: ConversionTagOptions | false; } /** * 给 G2Plot 提供非常简单的开放开发的机制。目的是能够让社区和业务上自己基于 G2Plot 开发自己的定制图表库。主要分成几类图表: * 1. 领域专业的图表,内部同学因为没有场景,不一定能做的完善。 * 2. 定制业务的图表,不具备通用性 * 3. 趣味性的可视化组件 * 然后官方可以根据社区的情况,可以进行一些官方推荐和采纳。 * * 如果使用? * * ```ts * import { P } from '@antv/g2plot'; * import { GeoWorldMap, GeoWorldMapOptions } from 'g2plot-geo-world-map'; * * const plot = new P('container', { * geoJson: '', * longitude: '', * latitude: '', * }, GeoWorldMap, defaultOptions); * * plot.render(); * ``` */ export declare class P extends Plot { /** 统一为 any plot */ readonly type = "g2-plot"; /** 外部传入的 defaultOptions */ private defaultOptions; /** 外部传入的 adaptor 函数 */ private adaptor; /** * 相比普通图表增加 adaptor 参数。 * @param container * @param options * @param adaptor * @param defaultOptions */ constructor(container: string | HTMLElement, options: O, adaptor: Adaptor, defaultOptions?: Partial); /** * 实现父类方法,直接使用传入的 */ protected getDefaultOptions(): Partial; /** * 实现父类方法,直接使用传入的 */ protected getSchemaAdaptor(): Adaptor; } /** * adaptor flow 的参数 */ export declare type Params = { readonly chart: View; readonly options: O; /** 一些存储一些扩展信息,用户上游 adaptor 向下游传递临时数据 */ readonly ext?: Record; }; declare type PartialIntervalGeometryOptions = Pick; /** pattern 映射*/ export declare type PatternAttr = CanvasPattern | PatternOption | ((datum: Datum, color: string /** inherit color */) => PatternOption | CanvasPattern); declare type PatternCfg = { /** * @title 背景色 * @description pattern background color. Default: inherit (默认: 继承图形元素颜色) * @default "inherit" */ backgroundColor?: string; /** * @title 贴图图案填充色 */ fill?: string; /** * @title 填充透明度 */ fillOpacity?: number; /** * @title 描边色 * @description 贴图图案描边色 */ stroke?: string; /** * @title 描边透明度 */ strokeOpacity?: number; /** * @title 描边粗细 */ lineWidth?: number; /** * @title 透明度 * @description 整个pattern 透明度 */ opacity?: number; /** * @title 旋转角度 * @description 整个pattern 的旋转角度 */ rotation?: number; }; declare type PatternOption = { type: 'dot'; cfg?: DotPatternCfg; } | { type: 'line'; cfg?: LinePatternCfg; } | { type: 'square'; cfg?: SquarePatternCfg; }; /** 单独 pick 出来的用于基类的类型定义 */ declare type PickOptions = Pick; export declare class Pie extends Plot { /** * 获取 饼图 默认配置项 * 供外部使用 */ static getDefaultOptions(): Partial; /** 图表类型 */ type: string; /** * 更新数据 * @param data */ changeData(data: PieOptions['data']): void; /** * 获取 饼图 默认配置项, 供 base 获取 */ protected getDefaultOptions(): Partial; /** * 获取 饼图 的适配器 */ protected getSchemaAdaptor(): Adaptor; } export declare interface PieOptions extends Options { /** * @title 角度映射字段 */ readonly angleField: string; /** * @title 颜色映射字段 */ readonly colorField: string; /** * @title 饼图半径 */ readonly radius?: number; /** * @title 饼图内半径 */ readonly innerRadius?: number; /** * @title 饼图标签 * @description type: 'inner' | 'outer' | 'spider' */ readonly label?: Label; /** * @title 饼图图形样式 */ readonly pieStyle?: StyleAttr; /** * @title 圆环的开始角度 */ readonly startAngle?: number; /** * @title 圆环的结束角度 */ readonly endAngle?: number; /** * @title 指标卡组件 * @description 显示在环图中心,可以代替tooltip,显示环图数据的总计值和各项数据,启用 statistic 组件的同时将自动关闭tooltip */ readonly statistic?: Statistic; /** * @title 饼图形状映射 * @descriptio 自定义饼图形状 */ readonly shape?: ShapeAttr; } /** * 所有 plot 的基类 */ export declare abstract class Plot extends EE { /** * 获取默认的 options 配置项 * 每个组件都可以复写 */ static getDefaultOptions(): any; /** plot 类型名称 */ abstract readonly type: string; /** plot 的 schema 配置 */ options: O; /** plot 绘制的 dom */ readonly container: HTMLElement; /** G2 chart 实例 */ chart: Chart; /** resizer unbind */ private unbind; constructor(container: string | HTMLElement, options: O); /** * 创建 G2 实例 */ private createG2; /** * 计算默认的 chart 大小。逻辑简化:如果存在 width 或 height,则直接使用,否则使用容器大小 * @param width * @param height */ private getChartSize; /** * 绑定代理所有 G2 的事件 */ private bindEvents; /** * 获取默认的 options 配置项 * 每个组件都可以复写 */ protected getDefaultOptions(): any; /** * 每个组件有自己的 schema adaptor */ protected abstract getSchemaAdaptor(): Adaptor; /** * 绘制 */ render(): void; /** * 更新: 更新配置且重新渲染 * @param options */ update(options: Partial): void; /** * 更新配置 * @param options */ protected updateOption(options: Partial): void; /** * 设置状态 * @param type 状态类型,支持 'active' | 'inactive' | 'selected' 三种 * @param conditions 条件,支持数组 * @param status 是否激活,默认 true */ setState(type: StateName, condition: StateCondition, status?: boolean): void; /** * 获取状态 */ getStates(): StateObject[]; /** * 更新数据 * @override * @param options */ changeData(data: any): void; /** * 修改画布大小 * @param width * @param height */ changeSize(width: number, height: number): void; /** * 增加图表标注。通过 id 标识,如果匹配到,就做更新 */ addAnnotations(annotations: Annotation[], view?: View): void; /** * 删除图表标注。通过 id 标识,如果匹配到,就做删除 */ removeAnnotations(annotations: Array<{ id: string; } & Partial>): void; /** * 销毁 */ destroy(): void; /** * 执行 adaptor 操作 */ protected execAdaptor(): void; /** * 当图表容器大小变化的时候,执行的函数 */ protected triggerResize(): void; /** * 绑定 dom 容器大小变化的事件 */ private bindSizeSensor; /** * 取消绑定 */ private unbindSizeSensor; } /** 点位置信息 */ export declare type Point = { readonly x: number; readonly y: number; }; /** * point 辅助点的配置处理 * @param params */ export declare function point(params: Params): Params; export declare interface PointGeometryOptions extends GeometryOptions { /** x 轴字段 */ readonly xField?: string; /** y 轴字段 */ readonly yField?: string; /** 分组字段 */ readonly seriesField?: string; /** size 映射字段 */ readonly sizeField?: string; /** shape 的映射字段 */ readonly shapeField?: string; /** point 图形映射规则 */ readonly point?: MappingOptions; } /** * polygon 的配置处理 * @param params */ export declare function polygon(params: Params): Params; export declare interface PolygonGeometryOptions extends GeometryOptions { /** x 轴字段 */ readonly xField?: string; /** y 轴字段 */ readonly yField?: string; /** 分组字段 */ readonly seriesField?: string; /** point 图形映射规则 */ readonly polygon?: MappingOptions; } /** 描述一个点 x y 位置 */ export declare type Position = [number, number]; export declare class Progress extends Plot { /** * 获取 仪表盘 默认配置项 * 供外部使用 */ static getDefaultOptions(): Partial; /** 图表类型 */ type: string; /** * 更新数据 * @param percent */ changeData(percent: number): void; protected getDefaultOptions(): Partial; /** * 获取 进度图 的适配器 */ protected getSchemaAdaptor(): Adaptor; } /** mini 图类型定义需要 omit 很多的 G2 Options 配置 */ export declare interface ProgressOptions extends Omit { /** * @title 进度百分比 */ readonly percent: number; /** * @title 条图宽度占比 * @description 范围[0-1] */ readonly barWidthRatio?: number; /** * @title 进度条颜色 */ readonly color?: ColorAttr; /** * @title 进度条样式 */ readonly progressStyle?: StyleAttr; } declare interface QuadrantOptions { /** * @title x 基准线 * @description x 方向上的象限分割基准线 * @default 0 */ readonly xBaseline?: number; /** * @title y 基准线 * @description y 方向上的象限分割基准线 * @default 0 */ readonly yBaseline?: number; /** * @title 配置象限分割线的样式 */ readonly lineStyle?: RegionPositionBaseOption; /** * @title 象限样式 */ readonly regionStyle?: RegionPositionBaseOption[]; /** * @title 象限文本 */ readonly labels?: Labels[]; } export declare class Radar extends Plot { /** 图表类型 */ type: string; /** * @override * @param data */ changeData(data: any): void; /** * 获取 雷达图 默认配置 */ protected getDefaultOptions(): Partial; /** * 获取 雷达图 的适配器 */ protected getSchemaAdaptor(): Adaptor; } export declare interface RadarOptions extends Options { /** * @title x轴字段 */ readonly xField: string; /** * @title y轴字段 * @description 映射雷达图的射线长度 */ readonly yField: string; /** * @title 分组字段 */ readonly seriesField?: string; /** * @title 是否平滑 * @default false */ readonly smooth?: boolean; /** * @title 折线图形样式 */ readonly lineStyle?: ShapeStyle | ((x: any, y: any, series?: any) => ShapeStyle); /** * @title 数据点图形样式 */ readonly point?: PointGeometryOptions['point'] & Pick; /** * @title area 图形样式 * @description 均提供回调的方式, 不开放 field 映射配置 */ readonly area?: AreaGeometryOptions['area']; /** * @title 角度轴配置 */ readonly xAxis?: any; /** * @title 径向轴配置 */ readonly yAxis?: any; /** * @title 雷达图半径 */ readonly radius?: number; /** * @title 雷达图开始角度 */ readonly startAngle?: number; /** * @title 雷达图结束角度 */ readonly endAngle?: number; } /** * 玉珏图 */ export declare class RadialBar extends Plot { static getDefaultOptions(): Partial; /** 图表类型 */ type: string; /** * @override * @param data */ changeData(data: any): void; /** * 获取默认配置 */ protected getDefaultOptions(): Partial; /** * 获取适配器 */ protected getSchemaAdaptor(): Adaptor; } /** 配置类型定义 */ export declare interface RadialBarOptions extends Options, Pick { /** * @title x轴字段 */ readonly xField?: string; /** * @title y轴字段 */ readonly yField?: string; /** * @title 样式 */ readonly barStyle?: ShapeAttrs; /** * @title 最大旋转角度 * @description 范围0-360 */ readonly maxAngle?: number; /** * @title 圆半径 */ readonly radius?: number; /** * @title 圆内半径 */ readonly innerRadius?: number; /** * @title 圆环的开始角度 */ readonly startAngle?: number; /** * @title 圆环的结束角度 */ readonly endAngle?: number; /** * @title 颜色字段 */ readonly colorField?: string; /** * @title 类型 */ readonly type?: string; /** * @title 是否叠加 * @default false */ readonly isStack?: boolean; /** * @title 是否分组 * @default false */ readonly isGroup?: boolean; } declare type Range_2 = { /** * @title 辅助的刻度值 * @description 0 ~ 1 的数字 */ readonly ticks?: number[]; /** * @title 辅助刻度的颜色配置 */ readonly color?: string | string[]; /** * @title 仪表盘辅助背景的宽度 */ readonly width?: number; }; export declare type RawFields = string[] | ((type: string, field: 'color' | 'shape' | 'size' | 'style') => string[] | never); /** 一个区域描述 */ export declare type Region = { /** * @title 开始位置 * @description the top-left corner of layer-range, range from 0 to 1, relative to parent layer's range */ readonly start: Point; /** * @title 结束位置 * @description the bottom-right corner of layer-range, range from 0 to 1, relative to parent layer's range */ readonly end: Point; }; export declare type RegionPositionBaseOption = Types.RegionPositionBaseOption; /** * register a locale * @param locale * @param localeObj */ export declare function registerLocale(locale: string, localeObj: Locale): void; declare interface RegressionLineOptions { /** * @title 是否顶层显示 * @default false */ readonly top?: boolean; /** * @title 回归线类型 */ readonly type?: string; /** * @title 配置回归线样式 */ readonly style?: ShapeStyle; /** * @title 自定义算法 * @description [[0,0],[100,100]] */ readonly algorithm?: Array<[number, number]> | ((data: any) => Array<[number, number]>); } /** * scale 的 adaptor * @param axes */ declare function scale(axes: Record, meta?: Options['meta']): >(params: Params) => Params; export declare class Scatter extends Plot { /** * 获取 散点图 默认配置项 * 供外部使用 */ static getDefaultOptions(): Partial; /** 图表类型 */ type: string; constructor(container: string | HTMLElement, options: ScatterOptions); /** * @override * @param data */ changeData(data: ScatterOptions['data']): void; /** * 获取 散点图 的适配器 */ protected getSchemaAdaptor(): Adaptor; protected getDefaultOptions(): Partial; } export declare interface ScatterOptions extends Options { /** * @title x 轴字段 */ readonly xField: string; /** * @title y 轴字段 */ readonly yField: string; /** * @title 数据调整类型 * @description 数据调整类型 'jitter' | 'stack' | 'symmetric' | 'dodge' */ readonly type?: 'jitter' | 'stack' | 'symmetric' | 'dodge'; /** * @title 点大小映射对应的数据字段名 */ readonly sizeField?: string; /** * @title size 对应的图例 */ readonly sizeLegend?: Options['legend']; /** * @title 散点图大小 */ readonly size?: SizeAttr; /** * @title 点形状映射对应的数据字段名 */ readonly shapeField?: string; /** * @title shape 对应的图例 */ readonly shapeLegend?: Options['legend']; /** * @title 散点图形状 */ readonly shape?: ShapeAttr; /** * @title 散点图样式 */ readonly pointStyle?: StyleAttr; /** * @title 点颜色映射对应的数据字段名 */ readonly colorField?: string; /** * @title 四象限组件 */ readonly quadrant?: QuadrantOptions; /** * @title 归曲线 */ readonly regressionLine?: RegressionLineOptions; /** * @title 图表交互 */ readonly brush?: BrushCfg; } /** * schema 的配置处理 * @param params */ export declare function schema(params: Params): Params; export declare interface SchemaGeometryOptions extends GeometryOptions { /** x 轴字段 */ readonly xField?: string; /** y 轴字段 */ readonly yField?: string; /** 分组字段 */ readonly seriesField?: string; /** point 图形映射规则 */ readonly schema?: MappingOptions; } declare type Scrollbar = Types.ScrollbarOption; /** * 全局变量设置 * @param key * @param value */ export declare function setGlobal(datum: Record): void; /** 图形 shape 映射 */ export declare type ShapeAttr = string | string[] | ((datum: Datum) => string); /** 图形属性 */ export declare type ShapeStyle = ShapeAttrs; export declare type Size = { readonly width: number; readonly height: number; }; /** 尺寸大小映射 */ export declare type SizeAttr = number | [number, number] | ((datum: Datum) => number); declare type Slider = Types.SliderOption; /** * @title square pattern */ declare type SquarePatternCfg = PatternCfg & { /** * @title 矩形的大小 */ size?: number; /** * @title 矩形之间的间隔 */ padding?: number; /** * @title 是否交错 * @description 即 staggered squares. * @default true */ isStagger?: boolean; }; export declare type State = Types.StateOption; /** * @title 状态条件 */ export declare type StateCondition = (data: Datum | Data) => boolean; /** * @title 状态名称 * @description G2 Element 开放 'active' | 'inactive' | 'selected' | 'default' 四种状态 */ export declare type StateName = 'active' | 'inactive' | 'selected' | 'default'; /** * @title 状态对象 * @description 可通过 `plot.getStates()` 获取 */ export declare type StateObject = { data: Datum | Data; state: string; geometry: Geometry; element: Element_2; }; /** * 中心文本的统计信息,统一一个数据结构 */ export declare type Statistic = { /** * @title 标题 */ readonly title?: false | StatisticText; /** * @title 内容 */ readonly content?: false | StatisticText; }; /** * @title 统计文本 * @description 支持三种设置模式(优先级):customHtml > formatter > content */ export declare type StatisticText = { /** * @title 统计文本的样式 */ readonly style?: CSSStyle | ((datum: Datum) => CSSStyle); /** * @title 文本内容 */ readonly content?: string; /** * @title 文本的格式化 */ readonly formatter?: (datum?: Datum, data?: Data /** filterData */) => string; /** * @title 自定义中心文本的 html */ readonly customHtml?: (container: HTMLElement, view: View, datum?: Datum, data?: Data /** filterData */) => string; /** * @title 旋转弧度 */ readonly rotate?: number; /** * @title 横轴偏移值 */ readonly offsetX?: number; /** * @title 纵轴偏移值 */ readonly offsetY?: number; }; export declare class Stock extends Plot { /** * 获取 散点图 默认配置项 * 供外部使用 */ static getDefaultOptions(): Partial; /** 图表类型 */ type: string; /** * 默认配置 * g2/g2plot默 认 配 置 --> 图 表 默 认 配 置 --> 开 发 者 自 定 义 配 置 --> 最 终 绘 图 配 置 */ protected getDefaultOptions(): Partial; /** * 获取 蜡烛图 的适配器 */ protected getSchemaAdaptor(): Adaptor; /** * @override * @param data */ changeData(data: StockOptions['data']): void; } export declare interface StockOptions extends Options { /** * @title x 轴字段 日期 */ readonly xField: string; /** * @title y 轴映射 * @description range 【开盘价/收盘价/最高价/最低价】,设置一个指定 [open, close, high, low]【开盘价/收盘价/最高价/最低价】字段的数组 */ readonly yField: [string, string, string, string]; /** * @title 颜色配置 * @description 不支持 color 配置 */ /** * @title 上涨色 */ readonly risingFill?: string; /** * @title 下跌色 */ readonly fallingFill?: string; /** * @title 样式配置 */ readonly stockStyle?: StyleAttr; } /** 图形样式 style 映射 */ export declare type StyleAttr = ShapeStyle | ((datum: Datum) => ShapeStyle); declare type Tag = Word & { /** * @title 字体 */ font?: string; /** * @title 字体样式 */ style?: ShapeStyle['fontStyle']; /** * @title 文本粗细 */ weight?: FontWeight; /** * @title 旋转角度 */ rotate?: number; /** * @title 字体大小 */ size?: number; /** * @title 一个单词所占的盒子的内边距 * @description 值越大单词之间的间隔越大 */ padding?: number; /** * @title 是否包含文本 * @default false */ hasText?: boolean; /** * @title 单词所占盒子的宽度 */ width?: number; /** * @title 单词所占盒子的高度 */ height?: number; /** * @title x 轴坐标 */ x?: number; /** * @title y 轴坐标 */ y?: number; }; export declare type TextOption = Types.TextOption; /** 文字 */ export declare type TextStyle = { /** * @title 文本大小 */ readonly fontSize?: number; /** * @title 字体系列 */ readonly fontFamily?: string; /** * @title 文本粗细 */ readonly fontWeight?: number; /** * @title 文本行高 */ readonly lineHeight?: number; /** * @title 文本对齐方式 */ readonly textAlign?: 'center' | 'left' | 'right'; /** * @title 文本基线 */ readonly textBaseline?: 'middle' | 'top' | 'bottom'; }; /** * 设置全局主题配置 * @param params */ declare function theme>(params: Params): Params; export declare type Tooltip = false | TooltipOptions; /** * 通用 tooltip 配置 * @param params */ declare function tooltip>(params: Params): Params; /** tooltip 的回调 */ export declare type TooltipAttr = (datum: Datum) => { name: string; value: string | number; }; export declare type TooltipMapping = { /** * @title 映射字段 * @description 指定需要显示 tooltip 中的字段,默认是包含 x seriesFields y */ readonly fields?: string[] | false; /** * @title value 格式化 */ readonly formatter?: TooltipAttr; }; export declare type TooltipOptions = Types.TooltipCfg & TooltipMapping; /** * Transformations of coordinate */ declare type Transformations = Array<{ /** send (x, y) to (-x, y) */ type: 'reflectX'; } | { /** send (x, y) to (x, -y) */ type: 'reflectY'; } | { /** send (x, y) to (y, x) */ type: 'transpose'; }>; export declare const version = "2.4.21"; /** 一个文本信息,wordCloud 内部 */ declare interface Word { /** * @title 文本内容 */ text: string; /** * @title 该文本所占权重 */ value: number; /** * @title 用于指定颜色字段 */ color: string | number; /** * @title 原始数据 */ datum: Datum; } export declare class WordCloud extends Plot { /** * 获取 词云图 默认配置项 * 供外部使用 */ static getDefaultOptions(): Partial; /** 词云图 */ type: string; /** * @override * @param data */ changeData(data: any): void; /** * 获取默认的 options 配置项 */ protected getDefaultOptions(): Partial; /** * 覆写父类方法,词云图需要加载图片资源,所以需要异步渲染 */ render(): Promise; /** * 获取 词云图 的适配器 */ protected getSchemaAdaptor(): Adaptor; /** * 覆写父类的方法,因为词云图使用 单独的函数 进行布局,原理上有些不一样 */ protected triggerResize(): void; } export declare interface WordCloudOptions extends Options { /** * @title 词条内容字段 */ readonly wordField: string; /** * @title 词条权重字段 */ readonly weightField: string; /** * @title 根据该字段进行颜色映射 */ readonly colorField?: string; /** * @title 遮罩图片实例 * @description 可以是图片 URL 或者 base64 */ readonly imageMask?: HTMLImageElement | string; /** * @title 最大执行时间 */ readonly timeInterval?: number; /** * @title 自定义所使用的随机函数 * @description 其值可以是一个 [0, 1) 区间中的值;也可以是一个返回该值的函数,当该值是一个固定的值时,每次渲染;相同数据的词云图时,其对应的每个单词的布局坐标一致。 */ readonly random?: number | (() => number); /** * @title 词云图形状 * @description 1,当设置为 `archimedean` 时,整个词云图接近于`椭圆`的形状。 2,当设置为 `rectangular` 时,整个词云图接近于`矩形`的形状。 * @default "archimedean" */ readonly spiral?: 'archimedean' | 'rectangular'; /** * @title 自定义每个词语的坐标。 * @description 返回值必须包含 x 和 y 属性,其余的可选。也可以在 `wordStyle` 中的选项中设置。 */ readonly placementStrategy?: (word: Word, index?: number, words?: Word[]) => Partial & { x: number; y: number; }; readonly wordStyle?: WordStyle; } /** 词云字体样式 */ declare interface WordStyle { /** * @title 词云的字体 * @description 当为函数时,其参数是一个经过处理之后的数据元素的值 */ readonly fontFamily?: string | ((word: Word, index?: number, words?: Word[]) => string); /** * @title 设置字体的粗细 * @description 当为函数时,其参数是一个经过处理之后的数据元素的值 */ readonly fontWeight?: FontWeight | ((word: Word, index?: number, words?: Word[]) => FontWeight); /** * @title 每个单词所占的盒子的内边距 * @description 当为函数时,其参数是一个经过处理之后的数据元素的值 越大单词之间的间隔越大 * @default 1 */ readonly padding?: number | ((word: Word, index?: number, words?: Word[]) => number); /** * @title 字体的大小范围 * @description 当为函数时,其参数是一个经过处理之后的数据元素的值 */ readonly fontSize?: [number, number] | number | ((word: Word, index?: number, words?: Word[]) => number); /** * @title 旋转的最小角度和最大角度 * @description 如果值是 number 或者 function ,则 `rotationSteps` 选项将失效 * @default "[0, 90]" */ readonly rotation?: [number, number] | number | ((word: Word, index?: number, words?: Word[]) => number); /** * @title 旋转实际的步数 * @description 越大可能旋转角度越小,* 例如:如果 `rotation` 的值是 [0, 90],`rotationSteps` 的值是 3,则最终可能旋转的角度有三种,分别是 0 度、45度和 90 度。 * @default 2 */ readonly rotationSteps?: number; } /** 去除 readonly 修饰 */ export declare type Writable = { -readonly [P in keyof T]: T[P]; }; export { }