D3Charts~Charts()

new Charts()

Charts类

Extends

  • Eventful

Methods

clear()

清除所有view、model以及事件

Returns:
-

this

dispatchAction(model, type, payload, throttleopt)

触发事件

Parameters:
Name Type Attributes Default Description
model Object

组件model

type string

事件名称

payload any
throttle boolean <optional>
true

getDataModel(index)

获取指定的dataModel

Parameters:
Name Type Description
index number

dataModel的序数

Returns:
-

data model

Deprecated:
  • Yes

getDataUrl(optsopt)

生成dataUrl

Parameters:
Name Type Attributes Description
opts Object <optional>
Properties
Name Type Attributes Description
width number | string <optional>

Can be 'auto' (the same as null/undefined)

height number | string <optional>

Can be 'auto' (the same as null/undefined)

type string <optional>

jpg | png

backgroundColor string <optional>
Returns:
-

data url

getDom()

获取dom

Returns:
-

dom

getHeight() → {number}

Get container height

Returns:
number -

height of container

getModel(typeopt, indexopt) → {Object}

获取指定的model,或者globalModel(无参数时)

Parameters:
Name Type Attributes Description
type string <optional>

组件名称

index number | string | function <optional>

对应组件的index、name或方法选取

Returns:
Object -

返回指定的model

getViewOfComponentModel(componentModel) → {Object}

获取model对应的view

Parameters:
Name Type Description
componentModel Object

组件model

Returns:
Object -

返回model对应的view

getWidth() → {number}

Get container width

Returns:
number -

width of container

getZr()

获取zr实例

Returns:
-

instance of zr

isError() → {boolean}

是否错误状态

Returns:
boolean -

是否是错误状态

registerAction(model, type, callback, context)

注册事件

Parameters:
Name Type Description
model Object

组件model

type string

事件名称

callback function

回调函数

context any

resize(optsopt)

Resize the canvas. Should be invoked when container size is changed

Parameters:
Name Type Attributes Description
opts Object <optional>
Properties
Name Type Attributes Description
width number | string <optional>

Can be 'auto' (the same as null/undefined)

height number | string <optional>

Can be 'auto' (the same as null/undefined)

setOption(option, lazyUpdateopt)

设置参数

Parameters:
Name Type Attributes Default Description
option Object

配置参数

lazyUpdate Object <optional>
true

配置参数

Returns:
-

this

stopAnimation()

停止所有动画

toggleEdit(boolopt)

切换编辑状态

Parameters:
Name Type Attributes Description
bool boolean <optional>

true或false

update(forceopt)

调用globalModel的更新对标记为脏的model进行更新,并对有更新的model对应的view重新进行渲染

Parameters:
Name Type Attributes Description
force boolean <optional>

是否强制更新