0.0.3 • Published 3 years ago

worker-echarts v0.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

worker-echarts

🚄 使用教程

安装

  npm i install worker-echarts --save-dev or yarn add worker-echarts --save-dev

使用

You can use Echarts(4.3.2) API

import WorkerEcharts from "worker-echarts"

let workerEchart = new WorkerEcharts()

workerEchart.init(dom)
workerEchart.setOptions(options)

📖 文档

WorkerECharts

new WorkerECharts()

WorkerEcharts Class

workerECharts.registerTheme(name, theme) ⇒

注册主题

Returns: Promise对象

ParamTypeDescription
namestringlight or dark
themeObjectoptions

workerECharts.resizeAxisUnit(point) ⇒

重置x轴单位

Returns: Promise对象

ParamType
pointnumber

workerECharts.on(type, listener, isMust) ⇒ Object

绑定事件

Returns: Object - - {type,lisenter}对象

ParamTypeDescription
typeString监听echart类型
listenerfunction监听事件回调
isMustBoolean是否重置

workerECharts.off(indicator) ⇒

解绑事件

Returns: null

ParamTypeDescription
indicatorObject- { type:String,listener:function}

workerECharts.init(div, theme)

初始化

ParamTypeDescription
divdom | canvasdom对象或者canvas对象
themestringechart 主题

workerECharts.callMethod(methodName, ...args) ⇒

调用echart方法

Returns: Promise对象

ParamTypeDescription
methodNamestringechart方法名 resize、dispatchAction
...argsobject配置参数options

workerECharts.setOption(option, ...args) ⇒

调用echart的setOption

Returns: Promise对象

ParamTypeDescription
optionObjectechart 配置参数options
...argsObject其他配置 { notMerge?: boolean;replaceMerge?: stringstring[];lazyUpdate?: boolean;}

workerECharts.getOption() ⇒

获取当前echart的options

Returns: Promise对象

workerECharts.getAxisGrid() ⇒

获取当前坐标数据开始点起始点

Returns: Promise对象

workerECharts.getEchartXInterval() ⇒

获取当前横坐标数据

Returns: Promise对象

workerECharts.getEchartYInterval() ⇒

获取当前纵坐标数据

Returns: Promise对象

workerECharts.enlargeZoom() ⇒

启动或关闭 toolbox 中 dataZoom 的刷选状态。

Returns: promise对象

workerECharts.restoreZoom() ⇒

重置坐标轴

Returns: promise对象

workerECharts.chartDataZoom() ⇒

重置坐标轴 params {Object}- {type: String,dataZoomIndex: Number, start: Number,end: Number,startValue: Number,endValue: Number}

Returns: promise对象

workerECharts.dispatchAction(payload) ⇒

调用echart 的dispatchAction

Returns: promise对象

ParamTypeDescription
payloadObject配置参数

workerECharts.resize(opts) ⇒

调用echart的resize方法

Returns: Promise对象

ParamTypeDescription
optsObject配置参数

workerECharts.clean() ⇒

清除echart

Returns: Promise对象

workerECharts.dispose()

清除worker

workerECharts.postMessage(message) ⇒

将消息发送到工作线程;返回的承诺在onmessage消息返回时被解析

Returns: Promise对象

ParamTypeDescription
messageObjectmessage对象 {type:String,args: Array}
0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago