@alicloud/cloud-charts
Version:

38 lines (37 loc) • 1.63 kB
TypeScript
import { Chart, Types } from './types';
import { customFormatterConfig } from './common';
import { ReactElement } from 'react';
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?: (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;
}, defaultConfig?: Types.TooltipCfg, onTooltipChange?: Function, componentConfig?: Types.TooltipCfg): void;