Merge pull request #25907 from liveangela/echarts-new-feature

[echarts]: add new feature of echarts4.0 and echarts-gl
This commit is contained in:
Daniel Rosenwasser
2018-05-22 08:22:07 -07:00
committed by GitHub
2 changed files with 69 additions and 38 deletions

View File

@@ -1,13 +1,17 @@
// Type definitions for echarts
// Project: http://echarts.baidu.com/
// Definitions by: Xie Jingyang <https://github.com/xieisabug>, AntiMoron <https://github.com/AntiMoron>
// Definitions by: Xie Jingyang <https://github.com/xieisabug>
// AntiMoron <https://github.com/AntiMoron>
// Liveangela <https://github.com/liveangela>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare namespace echarts {
function init(dom: HTMLDivElement | HTMLCanvasElement, theme?: Object | string, opts?: {
function init(dom: HTMLDivElement | HTMLCanvasElement, theme?: object | string, opts?: {
devicePixelRatio?: number
renderer?: string
width?: number | string
height?: number | string
}): ECharts;
const graphic: Graphic;
@@ -15,10 +19,10 @@ declare namespace echarts {
interface Graphic {
clipPointsByRect(points: number[][], rect: ERectangle): number[][];
clipRectByRect(targetRect: ERectangle, rect: ERectangle): ERectangle;
LinearGradient: { new(x: number, y: number, x2: number, y2: number, colorStops: Array<Object>, globalCoord?: boolean): LinearGradient }
LinearGradient: { new(x: number, y: number, x2: number, y2: number, colorStops: object[], globalCoord?: boolean): LinearGradient }
}
function connect(group: string | Array<string>): void;
function connect(group: string | string[]): void;
function disConnect(group: string): void;
@@ -26,9 +30,9 @@ declare namespace echarts {
function getInstanceByDom(target: HTMLDivElement | HTMLCanvasElement): ECharts;
function registerMap(mapName: string, geoJson: Object, specialAreas?: Object): void;
function registerMap(mapName: string, geoJson: object, specialAreas?: object): void;
function registerTheme(themeName: string, theme: Object): void;
function registerTheme(themeName: string, theme: object): void;
interface MapObj {
/** geoJson data for map */
@@ -40,7 +44,7 @@ declare namespace echarts {
function getMap(mapName: string): MapObj;
interface LinearGradient {
colorStops: Array<Object>;
colorStops: object[];
global: boolean;
type: string;
x: number
@@ -60,17 +64,17 @@ declare namespace echarts {
getDom(): HTMLCanvasElement | HTMLDivElement
getOption(): Object
getOption(): object
resize(): void
dispatchAction(payload: Object): void
dispatchAction(payload: object): void
on(eventName: string, handler: Function, context?: Object): void
on(eventName: string, handler: Function, context?: object): void
off(eventName: string, handler?: Function): void
showLoading(type?: string, opts?: Object): void
showLoading(type?: string, opts?: object): void
hideLoading(): void
@@ -99,13 +103,17 @@ declare namespace echarts {
dispose(): void
/** 转换逻辑点到像素 */
convertToPixel(finder: ConvertFinder | string, value: string | Array<any>): string | Array<any>
convertToPixel(finder: ConvertFinder | string, value: string | any[]): string | any[]
convertFromPixel(finder: ConvertFinder | string, value: Array<any> | string): Array<any> | string
convertFromPixel(finder: ConvertFinder | string, value: any[] | string): any[] | string
containPixel(finder: ConvertFinder | string,
/** 要被判断的点,为像素坐标值,以 echarts 实例的 dom 节点的左上角为坐标 [0, 0] 点。*/
value: any[]): boolean
getModel(): {
getComponent(finder: string): any;
}
}
interface ConvertFinder {
@@ -135,31 +143,54 @@ declare namespace echarts {
interface EChartOption {
title?: EChartTitleOption
legend?: Object,
grid?: Object,
xAxis?: Object,
yAxis?: Object,
polar?: Object,
radiusAxis?: Object,
angleAxis?: Object,
radar?: Object,
dataZoom?: Array<Object>,
visualMap?: Array<Object>,
tooltip?: Object,
toolbox?: Object,
geo?: Object,
parallel?: Object,
parallelAxis?: Object,
timeline?: Object,
series?: Array<Object>,
color?: Array<Object>,
legend?: object,
grid?: object,
xAxis?: object,
yAxis?: object,
polar?: object,
radiusAxis?: object,
angleAxis?: object,
radar?: object,
dataZoom?: object[],
visualMap?: object[],
tooltip?: object,
axisPointer?: object,
toolbox?: object,
brush?: object,
geo?: object,
parallel?: object,
parallelAxis?: object,
singleAxis?: object,
timeline?: object,
graphic?: object | object[],
calendar?: object,
dataset?: object,
aria?: object,
series?: object[],
color?: string[],
backgroundColor?: string,
textStyle?: Object,
textStyle?: object,
animation?: boolean,
animationThreshold?: number,
animationDuration?: number,
animationEasing?: string,
animationDurationUpdate?: number,
animationEasingUpdate?: string
animationDelay?: number | Function,
animationDurationUpdate?: number | Function,
animationEasingUpdate?: string,
animationDelayUpdate?: number | Function,
progressive?: number,
progressiveThreshold?: number,
blendMode?: string,
hoverLayerThreshold?: number,
useUTC?: boolean,
/** echarts-gl options */
globe?: object,
geo3D?: object,
mapbox3D?: object,
grid3D?: object,
xAxis3D?: object,
yAxis3D?: object,
zAxis3D?: object
}
interface EChartTitleOption {
@@ -167,11 +198,11 @@ declare namespace echarts {
text?: string;
link?: string,
target?: string,
textStyle?: Object,
textStyle?: object,
subtext?: string,
sublink?: string,
subtarget?: string,
subtextStyle?: Object,
subtextStyle?: object,
padding?: number,
itemGap?: number,
zlevel?: number,

View File

@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
@@ -20,4 +20,4 @@
"files": [
"index.d.ts"
]
}
}