klinecharts / KLineChart

📈Lightweight k-line chart that can be highly customized. Zero dependencies. Support mobile.(可高度自定义的轻量级k线图,无第三方依赖,支持移动端)

Home Page:https://klinecharts.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

简单的配置选项是否可以简化一下

yunTerry opened this issue · comments

需求描述

建议去掉一些简单的枚举类型,直接传字符串

具体实现

比如这三个类型

export declare enum YAxisPosition {
	Left = "left",
	Right = "right"
}
export declare enum YAxisType {
	Normal = "normal",
	Percentage = "percentage",
	Log = "log"
}
export interface YAxisStyle extends AxisStyle {
	type: YAxisType;
	position: YAxisPosition;
	inside: boolean;
	reverse: boolean;
}

可以简化成

export interface YAxisStyle extends AxisStyle {
	type: 'normal' | 'percentage' | 'log';
	position: 'left' | 'right';
	inside: boolean;
	reverse: boolean;
}

这样写ts的时候少导几个类型,也更直观

类似的还有TooltipShowType、TooltipShowRule