UNPKG

@alicloud/cloud-charts

Version:

![](https://img.shields.io/npm/v/@alicloud/cloud-charts?color=%23ff8200)

43 lines (42 loc) 1.79 kB
import { Chart, Types } from './types'; import { customFormatterConfig } from './common'; import { ReactElement } from 'react'; import { YAxisConfig } from './rectYAxis'; export interface TooltipConfig extends customFormatterConfig { visible?: boolean; sort?: 'asce' | 'desc' | ((a: any, b: any) => number); showTitle?: boolean; showColon?: boolean; position?: 'top' | 'bottom' | 'left' | 'right'; offset?: number; customConfig?: Types.TooltipCfg; titleFormatter?: (title: string, datum: Types.Datum) => string; nameFormatter?: (name: any, datum: Types.Datum, index: number, items: any[]) => string | number; valueFormatter?: (value: any, datum: Types.Datum, index: number, items: any[]) => string | number; /** Html 自定义内容块 */ customContent?: (title: string, data: any[]) => string | HTMLElement; reactContent?: (title: string, data: any[]) => ReactElement; /** 内容分列展示 */ columns?: number | false; /** 是否可点击锁定 */ lockable?: boolean; dodge?: boolean; customTooltip?: boolean | ((title: string, data: any[]) => ReactElement); } /** * rectTooltip 直角坐标系的tooltip配置 * * @param {this} ctx 组件实例 this 指针 * @param {Chart} chart 图表实例 * @param {Object} config 配置项 * @param {Object} defaultConfig 组件的自定义配置 * @param {Function} onTooltipChange 自定义 tooltip:change 事件 * @param {Object} componentConfig * */ export default function <T>(ctx: T, chart: Chart, config: { tooltip?: TooltipConfig | boolean; yAxis?: YAxisConfig | YAxisConfig[] | boolean; xAxis?: { type?: string; } | false; }, defaultConfig?: Types.TooltipCfg, onTooltipChange?: Function, componentConfig?: Types.TooltipCfg): void;