first commit
This commit is contained in:
98
src/types.ts
Normal file
98
src/types.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* 罗盘类型定义
|
||||
*/
|
||||
|
||||
/**
|
||||
* 文字径向位置
|
||||
*/
|
||||
export type TextRadialPosition = 'centroid' | 'middle';
|
||||
|
||||
/**
|
||||
* 示例配置
|
||||
*/
|
||||
export interface Example {
|
||||
/** 示例名称 */
|
||||
name: string;
|
||||
/** 角度分割点(度,北为0,顺时针),必须从0开始并以360结束 */
|
||||
angles: number[];
|
||||
/** 圆环半径列表(从中心到外:比如 [40, 80, 120] 表示3层;第一层内半径=0) */
|
||||
radii: number[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 扇区配置
|
||||
*/
|
||||
export interface Sector {
|
||||
/** 唯一标识 */
|
||||
key: string;
|
||||
/** 层索引 */
|
||||
layerIndex: number;
|
||||
/** 扇区索引 */
|
||||
pieIndex: number;
|
||||
/** 内半径 */
|
||||
rInner: number;
|
||||
/** 外半径 */
|
||||
rOuter: number;
|
||||
/** 起始角度(度) */
|
||||
aStart: number;
|
||||
/** 结束角度(度) */
|
||||
aEnd: number;
|
||||
/** 中间角度(度) */
|
||||
aMidDeg: number;
|
||||
/** 中间角度(弧度) */
|
||||
aMidRad: number;
|
||||
/** 形心 x 坐标 */
|
||||
cx: number;
|
||||
/** 形心 y 坐标 */
|
||||
cy: number;
|
||||
/** 填充颜色 */
|
||||
fill: string;
|
||||
/** 文字颜色 */
|
||||
textColor: string;
|
||||
/** 标签文本 */
|
||||
label: string;
|
||||
/** SVG 路径 */
|
||||
path: string;
|
||||
/** 内缩填色路径(可选)*/
|
||||
innerFillPath?: string;
|
||||
/** 填色颜色(可选)*/
|
||||
innerFillColor?: string;
|
||||
/** 文字路径 */
|
||||
textPath: string;
|
||||
/** 文字路径ID */
|
||||
textPathId: string;
|
||||
/** 字体大小(根据扇区尺寸动态计算) */
|
||||
fontSize: number;
|
||||
/** 是否竖排文字 */
|
||||
isVertical: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 极坐标点
|
||||
*/
|
||||
export interface PolarPoint {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆环扇形参数
|
||||
*/
|
||||
export interface AnnularSectorParams {
|
||||
rInner: number;
|
||||
rOuter: number;
|
||||
aStartDeg: number;
|
||||
aEndDeg: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆环扇形形心结果
|
||||
*/
|
||||
export interface CentroidResult {
|
||||
cx: number;
|
||||
cy: number;
|
||||
rho: number;
|
||||
aMidDeg: number;
|
||||
aMidRad: number;
|
||||
deltaDeg: number;
|
||||
}
|
||||
Reference in New Issue
Block a user