thsc-datav-standard-chart
Version:
标准范式组件
59 lines (58 loc) • 2.47 kB
TypeScript
import { type ECharts, type SeriesModel } from 'echarts';
import { type PathState } from 'zrender';
import { ElementProps, ElementStatePropNames, ElementAnimateConfig } from 'zrender/lib/Element';
import type StandardChart from '../core/StandardChart';
export type ElemmentStateProps = Pick<ElementProps, ElementStatePropNames> & PathState;
interface ElementStates {
hide: ElemmentStateProps;
show: ElemmentStateProps;
}
export interface StateTransitionConfig {
stateAnimationConfig?: ElementAnimateConfig;
states: ElementStates;
}
export type ModelAndView = {
model: SeriesModel;
view: unknown;
};
type MarkState = {
state: 'show' | 'hide';
};
type MarkStates = {
mark: (MarkState & {
categoryIndex: number;
})[];
};
type StateTransitionHandler = (state: 'show' | 'hide', markIndex: number, markerIndex: number, categoryIndex: number, markerStates: MarkStates[]) => number[];
export declare class DynamicDvMarker {
private _Chart;
myChart: ECharts;
markerModelsAndViews: ModelAndView[];
private markerStates;
StateTransitionAnimationConfig: StateTransitionConfig;
constructor(chart: StandardChart, config?: StateTransitionConfig);
private init;
updateMarkState(): void;
setMarkState(markerIndex: number, markIndex: number, state: 'show' | 'hide'): void;
/**
*
* @param state 要转换的状态
* @param markerIndex 当前marker系列在所有marker系列中的序号
* @param categoryIndex x轴的索引
* @param showHandler 当前marker系列哪些需要显示的标记的处理函数,返回一个标记的索引数组
* @param hideHandler 当前marker系列哪些需要隐藏的标记的处理函数,返回一个标记的索引数组
* @returns
*/
showOrHide(state: 'hide' | 'show', markerIndex: number, categoryIndex: number, showHandler?: StateTransitionHandler, hideHandler?: StateTransitionHandler): number;
/**
* 显示某个x轴序号上的所有标记
* @param categoryIndex x轴索引
* @param isStream 是否开启流水线式显示,即下一个标记显示之前,隐藏上一个标价,最后一个标记显示时,全部标记都显示.
* @param all 是否显示全部
* @default
* isStream = true
* all = false
*/
show(categoryIndex?: number, isStream?: boolean, all?: boolean, showHandler?: StateTransitionHandler, hideHandler?: StateTransitionHandler): void;
}
export {};