data-vis-ui
Version:
## [使用文档](https://temp-static-domain.jd.com/data-vis-ui)
58 lines (52 loc) • 1.44 kB
TypeScript
/*
* @Author: 石丽丽
* @description : 类型定义
* @@copyRight: 京东科技IOT
*/
import * as echarts from 'echarts';
export type EChartsOption = echarts.EChartsOption;
export type LinesSeriesOption = echarts.LinesSeriesOption;
export type StringPos =
| 'left'
| 'right'
| 'top'
| 'bottom'
| 'inside'
| 'insideLeft'
| 'insideRight'
| 'insideTop'
| 'insideBottom'
| 'insideTopLeft'
| 'insideTopRight'
| 'insideBottomLeft'
| 'insideBottomRight';
export type Direction = 'top' | 'bottom' | 'left' | 'right';
/** 节点类型 */
export interface NodeItem {
id: keyof any;
name?: string;
labelPos?: StringPos | (string | number)[]; // 文字的位置
value: number[];
symbolSize?: number[]; // 图片大小,单一一个数字表示宽,两个表示宽和高
image: string | NodeModule;
data?: string[];
label?: any; // echarts的Label
}
/** 连线数据,两种形式,一种是从一个点的上下左右到另外一个点的上下左右;另外一种是非节点间连线 */
export type LineType = 'nodeTonode' | 'pointTopoint';
export type LineStyle = {
type: 'solid' | 'dashed' | 'dotted';
width: number;
color: string;
};
export type LineItem = {
type: LineType;
coords: (number | string | Direction)[][];
lineStyle?: LineStyle;
};
export type ConnectGraphProps = {
nodes: NodeItem[];
lines: LineItem[];
style?: React.CSSProperties;
option?: EChartsOption;
};