@echarts-component/vue
Version:
Echarts component for Vue
73 lines (72 loc) • 2.46 kB
TypeScript
import { ECBasicOption, ResizeOpts, SetOptionOpts } from 'echarts/types/dist/shared';
type Coordinate = "series" | "xAxis" | "yAxis" | "grid" | "geo";
type CoordinateQuery<T extends Coordinate = Coordinate> = {
[K in `${T}Index`]: number;
} & {
[K in `${T}Name`]: string;
} & {
[K in `${T}Id`]: string;
};
export type setOption = ((option: ECBasicOption, notMerge?: boolean, lazyUpdate?: boolean) => void) | ((option: ECBasicOption, opts?: SetOptionOpts) => void);
export type getOption = () => ECBasicOption;
export type getWidth = () => number;
export type getHeight = () => number;
export type getDom = () => HTMLCanvasElement | HTMLDivElement;
export type resize = (opts?: ResizeOpts) => void;
export type clear = () => void;
export type dispose = () => void;
export type isDisposed = () => boolean;
export type renderToSVGString = (opts?: {
useViewBox?: boolean;
}) => string;
export type convertFromPixel = (finder: CoordinateQuery, value: number[] | number) => number[] | number;
export type convertToPixel = (finder: CoordinateQuery, value: number[] | number) => number[] | number;
type LoadingType = "default";
interface LoadingOption {
text: string;
color: string;
textColor: string;
maskColor: string;
zlevel: number;
fontSize: number;
showSpinner: boolean;
spinnerRadius: number;
lineWidth: number;
fontWeight: string;
fontStyle: string;
fontFamily: string;
}
export type showLoading = (type?: LoadingType, opts?: LoadingOption) => void;
export type hideLoading = () => void;
interface DataURLOption {
type?: string;
pixelRatio?: number;
backgroundColor?: string;
excludeComponents?: Array<string>;
}
export type getDataURL = (opts: DataURLOption) => string;
export type getConnectedDataURL = (opts: DataURLOption) => string;
export type appendData<T> = (opts: {
seriesIndex?: number;
data?: Array<T> | T;
}) => string;
export interface Methods {
setOption: setOption;
getWidth: getWidth;
getHeight: getHeight;
getDom: getDom;
getOption: getOption;
resize: resize;
clear: clear;
dispose: dispose;
isDisposed: isDisposed;
renderToSVGString: renderToSVGString;
convertFromPixel: convertFromPixel;
convertToPixel: convertToPixel;
showLoading: showLoading;
hideLoading: hideLoading;
appendData: appendData<any>;
getDataURL: getDataURL;
getConnectedDataURL: getConnectedDataURL;
}
export {};