Enable JavaScript to run this app.
G2
文档
API
图表示例
主题
周边生态
所有产品
5.3.0
概览
下一篇
Chart
Loading...
提供简洁的命令式 API,一句话生成图表。
Chart
创建可视化
new Chart
- 创建 Chart 实例。
chart.
interval
- 添加 interval 标记到该视图。
chart.
rect
- 添加 rect 标记到该视图。
chart.
point
- 添加 point 标记到该视图。
chart.
area
- 添加 area 标记到该视图。
chart.
line
- 添加 line 标记到该视图。
chart.
vector
- 添加 vector 标记到该视图。
chart.
link
- 添加 link 标记到该视图。
chart.
polygon
- 添加 polygon 标记到该视图。
chart.
image
- 添加 image 标记到该视图。
chart.
text
- 添加 text 标记到该视图。
chart.
lineX
- 添加 lineX 标记到该视图。
chart.
lineY
- 添加 lineY 标记到该视图。
chart.
range
- 添加 range 标记到该视图。
chart.
rangeX
- 添加 rangeX 标记到该视图。
chart.
rangeY
- 添加 rangeY 标记到该视图。
chart.
connector
- 添加 connector 标记到该视图。
chart.
sankey
- 添加 sankey 标记到该视图。
chart.
treemap
- 添加 treemap 标记到该视图。
chart.
boxplot
- 添加 boxplot 标记到该视图。
chart.
density
- 添加 density 标记到该视图。
chart.
heatmap
- 添加 heatmap 标记到该视图。
chart.
shape
- 添加 shape 标记到该视图。
chart.
pack
- 添加 pack 标记到该视图。
chart.
forceGraph
- 添加 forceGraph 标记到该视图。
chart.
tree
- 添加 tree 标记到该视图。
chart.
wordCloud
- 添加 wordCloud 标记到该视图。
chart.
gauge
- 添加 gauge 标记到该视图。
chart.
view
- 添加 view 到该图表。
chart.
spaceLayer
- 添加 spaceLayer 到该图表。
chart.
spaceFlex
- 添加 spaceFlex 到该图表。
chart.
facetRect
- 添加 facetRect 到该图表。
chart.
facetCircle
- 添加 facetCircle 到该图表。
chart.
repeatMatrix
- 添加 repeatMatrix 到该图表。
chart.
timingKeyframe
- 添加 timingKeyframe 到该图表。
chart.
geoView
- 添加 geoView 到该图表。
chart.
geoPath
- 添加 geoPath 到该图表。
chart.
point3D
- 添加 point3D 标记到该视图。
设置属性
chart.
attr
- 设置或获取 chart 的属性。
chart.
width
- 设置或获取 width 的属性。
chart.
height
- 设置或获取 height 的属性。
chart.
title
- 设置或获取 title 的属性。
chart.
encode
- 设置或获得 chart 的 encode。
chart.
options
- 设置或获取视图上的属性。
chart.
data
- 设置或获取该视图的 data。
chart.
transform
- 设置或获取该视图的 transform。
chart.
theme
- 设置或获取该视图的 theme。
chart.
style
- 设置或获取该视图的 style。
chart.
scale
- 设置或获取该视图的 scale。
chart.
coordinate
- 设置或获取该视图的 coordinate。
chart.
axis
- 设置或获取该视图的 axis。
chart.
legend
- 设置或获取该视图的 legend。
chart.
labelTransform
- 设置或获取该视图的 labelTransform。
获取实例
chart.
getNodeByKey
- 根据 key 获取 mark。
chart.
getNodeByType
- 根据 type 获取 mark 数组。
chart.
getContext
- 获取视图的 context 信息。
chart.
getContainer
- 获取视图的外部容器。
chart.
getView
- 获取视图的 view 实例。
chart.
getCoordinate
- 获取视图的 coordinate 实例。
chart.
getGroup
- 获取视图的 canvas group 实例。
chart.
getScale
- 获取该视图的 scale。
chart.
getScaleByChannel
- 获取指定通道的比例尺。
渲染图表
chart.
render
- 渲染图表。
chart.
clear
- 清空图表。
chart.
destroy
- 清空该视图并销毁 canvas 画布。
chart.
changeSize
- 修改图表尺寸。
chart.
changeData
- 修改图表数据。
chart.
forceFit
- 强制自适应布局。
chart.
show
- 显示图表。
chart.
hide
- 隐藏图表。
事件
chart.
on
- 监听图表事件。
chart.
once
- 监听图表事件(仅允许执行一次)。
chart.
emit
- 触发视图事件。
chart.
off
- 销毁视图事件。
Mark
设置属性
mark.
attr
- 设置或获取 mark 的属性。
mark.
data
- 设置或获取 mark 的 data。
mark.
encode
- 设置或获取 mark 的 encode。
mark.
transform
- 设置或获取 mark 的 transform。
mark.
scale
- 设置或获取 mark 的 scale。
mark.
interaction
- 设置或获取 mark 的 interaction。
mark.
label
- 设置或获取 mark 的 label。
mark.
animate
- 设置或获取 mark 的 animate。
mark.
coordinate
- 设置或获取 mark 的 coordinate。
mark.
axis
- 设置或获取 mark 的 axis。
mark.
legend
- 设置或获取 mark 的 legend。
mark.
slider
- 设置或获取 mark 的 slider。
mark.
scrollbar
- 设置或获取 mark 的 scrollbar。
mark.
state
- 设置或获取 mark 的 state。
mark.
tooltip
- 设置或获取 mark 的 tooltip。
获取实例
mark.
changeData
- 修改 mark 数据。
mark.
getMark
- 获取 mark 实例。
mark.
getScale
- 获取 scale 实例。
mark.
getScaleByChannel
- 获取指定通道的 scale 实例。
mark.
getGroup
- 获取 canvas group 实例。
View
创建可视化
view.
interval
- 添加 interval 标记到该视图。
view.
rect
- 添加 rect 标记到该视图。
view.
point
- 添加 point 标记到该视图。
view.
area
- 添加 area 标记到该视图。
view.
line
- 添加 line 标记到该视图。
view.
vector
- 添加 vector 标记到该视图。
view.
link
- 添加 link 标记到该视图。
view.
polygon
- 添加 polygon 标记到该视图。
view.
image
- 添加 image 标记到该视图。
view.
text
- 添加 text 标记到该视图。
view.
lineX
- 添加 lineX 标记到该视图。
view.
lineY
- 添加 lineY 标记到该视图。
view.
range
- 添加 range 标记到该视图。
view.
rangeX
- 添加 rangeX 标记到该视图。
view.
rangeY
- 添加 rangeY 标记到该视图。
view.
connector
- 添加 connector 标记到该视图。
view.
sankey
- 添加 sankey 标记到该视图。
view.
treemap
- 添加 treemap 标记到该视图。
view.
boxplot
- 添加 boxplot 标记到该视图。
view.
shape
- 添加 shape 标记到该视图。
view.
pack
- 添加 pack 标记到该视图。
view.
forceGraph
- 添加 forceGraph 标记到该视图。
view.
tree
- 添加 tree 标记到该视图。
view.
wordCloud
- 添加 wordCloud 标记到该视图。
view.
gauge
- 添加 gauge 标记到该视图。
设置属性
view.
attr
- 设置或获取该视图的属性。
view.
coordinate
- 声明该视图的 coordinate。
view.
data
- 设置或获取该视图的 data。
view.
transform
- 设置或获取该视图的 transform。
view.
interaction
- 设置或获取 view 的 interaction。
view.
theme
- 设置或获取该视图的主题。
view.
style
- 设置或获取该视图的 style。
view.
scale
- 设置或获取该视图的 scale。
view.
axis
- 设置或获取该视图的 axis。
view.
legend
- 设置或获取该视图的 legend。
view.
labelTransform
- 设置或获取该视图的 labelTransform。
获取实例
view.
getNodeByKey
- 根据 key 获取标记。
view.
getNodeByType
- 根据 key 获取标记数组。
view.
getView
- 获取视图的 view 实例。
view.
getCoordinate
- 获取视图的 coordinate 实例。
view.
getGroup
- 获取视图的 canvas group 实例。
view.
getView
- 获取视图的 view 实例。
view.
getCoordinate
- 获取视图的 coordinate 实例。
view.
getGroup
- 获取视图的 canvas group 实例。
view.
getScale
- 获取该视图的 scale。
view.
getScaleByChannel
- 获取指定通道的比例尺。
GeoView
创建可视化
geoView.
view
- 添加 view 标记到该地理视图。
geoView.
interval
- 添加 interval 标记到该地理视图。
geoView.
rect
- 添加 rect 标记到该地理视图。
geoView.
point
- 添加 point 标记到该地理视图。
geoView.
area
- 添加 area 标记到该地理视图。
geoView.
line
- 添加 line 标记到该地理视图。
geoView.
vector
- 添加 vector 标记到该地理视图。
geoView.
link
- 添加 link 标记到该地理视图。
geoView.
polygon
- 添加 polygon 标记到该地理视图。
geoView.
image
- 添加 image 标记到该地理视图。
geoView.
text
- 添加 text 标记到该地理视图。
geoView.
lineX
- 添加 lineX 标记到该地理视图。
geoView.
lineY
- 添加 lineY 标记到该地理视图。
geoView.
range
- 添加 range 标记到该地理视图。
geoView.
rangeX
- 添加 rangeX 标记到该地理视图。
geoView.
rangeY
- 添加 rangeY 标记到该地理视图。
geoView.
connector
- 添加 connector 标记到该地理视图。
geoView.
sankey
- 添加 sankey 标记到该地理视图。
geoView.
treemap
- 添加 treemap 标记到该地理视图。
geoView.
boxplot
- 添加 boxplot 标记到该地理视图。
geoView.
shape
- 添加 shape 标记到该地理视图。
geoView.
pack
- 添加 pack 标记到该地理视图。
geoView.
forceGraph
- 添加 forceGraph 标记到该地理视图。
geoView.
tree
- 添加 tree 标记到该地理视图。
geoView.
wordCloud
- 添加 wordCloud 标记到该地理视图。
geoView.
gauge
- 添加 gauge 标记到该地理视图。
设置属性
geoView.
attr
- 设置或获取该复合视图的属性。
geoView.
data
- 设置或获取该复合视图的 data。
geoView.
transform
- 设置或获取该复合视图的 transform。
geoView.
coordinate
- 设置或获取该复合视图的 coordinate。
geoView.
theme
- 设置或获取该复合视图的主题。
geoView.
style
- 设置或获取该复合视图的 style。
geoView.
scale
- 设置或获取该复合视图的 scale。
geoView.
legend
- 设置或获取该复合视图的 legend。
SpaceLayer
创建可视化
spaceLayer.
view
- 添加 view 标记到该复合视图。
spaceLayer.
interval
- 添加 interval 标记到该复合视图。
spaceLayer.
rect
- 添加 rect 标记到该复合视图。
spaceLayer.
point
- 添加 point 标记到该复合视图。
spaceLayer.
area
- 添加 area 标记到该复合视图。
spaceLayer.
line
- 添加 line 标记到该复合视图。
spaceLayer.
vector
- 添加 vector 标记到该复合视图。
spaceLayer.
link
- 添加 link 标记到该复合视图。
spaceLayer.
polygon
- 添加 polygon 标记到该复合视图。
spaceLayer.
image
- 添加 image 标记到该复合视图。
spaceLayer.
text
- 添加 text 标记到该复合视图。
spaceLayer.
lineX
- 添加 lineX 标记到该复合视图。
spaceLayer.
lineY
- 添加 lineY 标记到该复合视图。
spaceLayer.
range
- 添加 range 标记到该复合视图。
spaceLayer.
rangeX
- 添加 rangeX 标记到该复合视图。
spaceLayer.
rangeY
- 添加 rangeY 标记到该复合视图。
spaceLayer.
connector
- 添加 connector 标记到该复合视图。
spaceLayer.
sankey
- 添加 sankey 标记到该复合视图。
spaceLayer.
treemap
- 添加 treemap 标记到该复合视图。
spaceLayer.
boxplot
- 添加 boxplot 标记到该复合视图。
spaceLayer.
shape
- 添加 shape 标记到该复合视图。
spaceLayer.
pack
- 添加 pack 标记到该复合视图。
spaceLayer.
forceGraph
- 添加 forceGraph 标记到该视图。
spaceLayer.
tree
- 添加 tree 标记到该视图。
spaceLayer.
wordCloud
- 添加 wordCloud 标记到该视图。
spaceLayer.
gauge
- 添加 gauge 标记到该视图。
设置属性
spaceLayer.
data
- 设置或获取该复合视图的 data。
SpaceFlex
创建可视化
spaceFlex.
view
- 添加 view 标记到该复合视图。
spaceFlex.
interval
- 添加 interval 标记到该复合视图。
spaceFlex.
rect
- 添加 rect 标记到该复合视图。
spaceFlex.
point
- 添加 point 标记到该复合视图。
spaceFlex.
area
- 添加 area 标记到该复合视图。
spaceFlex.
line
- 添加 line 标记到该复合视图。
spaceFlex.
vector
- 添加 vector 标记到该复合视图。
spaceFlex.
link
- 添加 link 标记到该复合视图。
spaceFlex.
polygon
- 添加 polygon 标记到该复合视图。
spaceFlex.
image
- 添加 image 标记到该复合视图。
spaceFlex.
text
- 添加 text 标记到该复合视图。
spaceFlex.
lineX
- 添加 lineX 标记到该复合视图。
spaceFlex.
lineY
- 添加 lineY 标记到该复合视图。
spaceFlex.
range
- 添加 range 标记到该复合视图。
spaceFlex.
rangeX
- 添加 rangeX 标记到该复合视图。
spaceFlex.
rangeY
- 添加 rangeY 标记到该复合视图。
spaceFlex.
connector
- 添加 connector 标记到该复合视图。
spaceFlex.
sankey
- 添加 sankey 标记到该复合视图。
spaceFlex.
treemap
- 添加 treemap 标记到该复合视图。
spaceFlex.
boxplot
- 添加 boxplot 标记到该复合视图。
spaceFlex.
shape
- 添加 shape 标记到该复合视图。
spaceFlex.
pack
- 添加 pack 标记到该复合视图。
spaceFlex.
forceGraph
- 添加 forceGraph 标记到该视图。
spaceFlex.
tree
- 添加 tree 标记到该视图。
spaceFlex.
wordCloud
- 添加 wordCloud 标记到该视图。
spaceFlex.
gauge
- 添加 gauge 标记到该视图。
设置属性
spaceFlex.
attr
- 设置或获取该复合视图的属性。
spaceFlex.
data
- 设置或获取该复合视图的 data。
FacetRect
创建可视化
facetRect.
view
- 添加 view 标记到该复合视图。
facetRect.
interval
- 添加 interval 标记到该复合视图。
facetRect.
rect
- 添加 rect 标记到该复合视图。
facetRect.
point
- 添加 point 标记到该复合视图。
facetRect.
area
- 添加 area 标记到该复合视图。
facetRect.
line
- 添加 line 标记到该复合视图。
facetRect.
vector
- 添加 vector 标记到该复合视图。
facetRect.
link
- 添加 link 标记到该复合视图。
facetRect.
polygon
- 添加 polygon 标记到该复合视图。
facetRect.
image
- 添加 image 标记到该复合视图。
facetRect.
text
- 添加 text 标记到该复合视图。
facetRect.
lineX
- 添加 lineX 标记到该复合视图。
facetRect.
lineY
- 添加 lineY 标记到该复合视图。
facetRect.
range
- 添加 range 标记到该复合视图。
facetRect.
rangeX
- 添加 rangeX 标记到该复合视图。
facetRect.
rangeY
- 添加 rangeY 标记到该复合视图。
facetRect.
connector
- 添加 connector 标记到该复合视图。
facetRect.
sankey
- 添加 sankey 标记到该复合视图。
facetRect.
treemap
- 添加 treemap 标记到该复合视图。
facetRect.
boxplot
- 添加 boxplot 标记到该复合视图。
facetRect.
shape
- 添加 shape 标记到该复合视图。
facetRect.
pack
- 添加 pack 标记到该复合视图。
facetRect.
forceGraph
- 添加 forceGraph 标记到该视图。
facetRect.
tree
- 添加 tree 标记到该视图。
facetRect.
wordCloud
- 添加 wordCloud 标记到该视图。
facetRect.
gauge
- 添加 gauge 标记到该视图。
设置属性
facetRect.
attr
- 设置或获取该复合视图的属性。
facetRect.
data
- 设置或获取该复合视图的 data。
facetRect.
transform
- 设置或获取该复合视图的 transform。
facetRect.
theme
- 设置或获取该复合视图的主题。
facetRect.
style
- 设置或获取该复合视图的 style。
facetRect.
scale
- 设置或获取该复合视图的 scale。
facetRect.
axis
- 设置或获取该复合视图的 axis。
facetRect.
legend
- 设置或获取该复合视图的 legend。
FacetCircle
创建可视化
facetCircle.
view
- 添加 view 标记到该复合视图。
facetCircle.
interval
- 添加 interval 标记到该复合视图。
facetCircle.
rect
- 添加 rect 标记到该复合视图。
facetCircle.
point
- 添加 point 标记到该复合视图。
facetCircle.
area
- 添加 area 标记到该复合视图。
facetCircle.
line
- 添加 line 标记到该复合视图。
facetCircle.
vector
- 添加 vector 标记到该复合视图。
facetCircle.
link
- 添加 link 标记到该复合视图。
facetCircle.
polygon
- 添加 polygon 标记到该复合视图。
facetCircle.
image
- 添加 image 标记到该复合视图。
facetCircle.
text
- 添加 text 标记到该复合视图。
facetCircle.
lineX
- 添加 lineX 标记到该复合视图。
facetCircle.
lineY
- 添加 lineY 标记到该复合视图。
facetCircle.
range
- 添加 range 标记到该复合视图。
facetCircle.
rangeX
- 添加 rangeX 标记到该复合视图。
facetCircle.
rangeY
- 添加 rangeY 标记到该复合视图。
facetCircle.
connector
- 添加 connector 标记到该复合视图。
facetCircle.
sankey
- 添加 sankey 标记到该复合视图。
facetCircle.
treemap
- 添加 treemap 标记到该复合视图。
facetCircle.
boxplot
- 添加 boxplot 标记到该复合视图。
facetCircle.
shape
- 添加 shape 标记到该复合视图。
facetCircle.
pack
- 添加 pack 标记到该复合视图。
facetCircle.
forceGraph
- 添加 forceGraph 标记到该视图。
facetCircle.
tree
- 添加 tree 标记到该视图。
facetCircle.
wordCloud
- 添加 wordCloud 标记到该视图。
facetCircle.
gauge
- 添加 gauge 标记到该视图。
设置属性
facetCircle.
attr
- 设置或获取该复合视图的属性。
facetCircle.
data
- 设置或获取该复合视图的 data。
facetCircle.
transform
- 设置或获取该复合视图的 transform。
facetCircle.
theme
- 设置或获取该复合视图的主题。
facetCircle.
style
- 设置或获取该复合视图的 style。
facetCircle.
scale
- 设置或获取该复合视图的 scale。
facetCircle.
axis
- 设置或获取该复合视图的 axis。
facetCircle.
legend
- 设置或获取该复合视图的 legend。
RepeatMatrix
创建可视化
repeatMatrix.
view
- 添加 view 标记到该复合视图。
repeatMatrix.
interval
- 添加 interval 标记到该复合视图。
repeatMatrix.
rect
- 添加 rect 标记到该复合视图。
repeatMatrix.
point
- 添加 point 标记到该复合视图。
repeatMatrix.
area
- 添加 area 标记到该复合视图。
repeatMatrix.
line
- 添加 line 标记到该复合视图。
repeatMatrix.
vector
- 添加 vector 标记到该复合视图。
repeatMatrix.
link
- 添加 link 标记到该复合视图。
repeatMatrix.
polygon
- 添加 polygon 标记到该复合视图。
repeatMatrix.
image
- 添加 image 标记到该复合视图。
repeatMatrix.
text
- 添加 text 标记到该复合视图。
repeatMatrix.
lineX
- 添加 lineX 标记到该复合视图。
repeatMatrix.
lineY
- 添加 lineY 标记到该复合视图。
repeatMatrix.
range
- 添加 range 标记到该复合视图。
repeatMatrix.
rangeX
- 添加 rangeX 标记到该复合视图。
repeatMatrix.
rangeY
- 添加 rangeY 标记到该复合视图。
repeatMatrix.
connector
- 添加 connector 标记到该复合视图。
repeatMatrix.
sankey
- 添加 sankey 标记到该复合视图。
repeatMatrix.
treemap
- 添加 treemap 标记到该复合视图。
repeatMatrix.
boxplot
- 添加 boxplot 标记到该复合视图。
repeatMatrix.
shape
- 添加 shape 标记到该复合视图。
repeatMatrix.
pack
- 添加 pack 标记到该复合视图。
repeatMatrix.
forceGraph
- 添加 forceGraph 标记到该视图。
repeatMatrix.
tree
- 添加 tree 标记到该视图。
repeatMatrix.
wordCloud
- 添加 wordCloud 标记到该视图。
repeatMatrix.
gauge
- 添加 gauge 标记到该视图。
设置属性
repeatMatrix.
attr
- 设置或获取该复合视图的属性。
repeatMatrix.
data
- 设置或获取该复合视图的 data。
repeatMatrix.
transform
- 设置或获取该复合视图的 transform。
repeatMatrix.
theme
- 设置或获取该复合视图的主题。
repeatMatrix.
style
- 设置或获取该复合视图的 style。
repeatMatrix.
scale
- 设置或获取该复合视图的 scale。
repeatMatrix.
axis
- 设置或获取该复合视图的 axis。
repeatMatrix.
legend
- 设置或获取该复合视图的 legend。
TimingKeyframe
创建可视化
timingKeyframe.
interval
- 添加 interval 标记到该复合视图。
timingKeyframe.
rect
- 添加 rect 标记到该复合视图。
timingKeyframe.
point
- 添加 point 标记到该复合视图。
timingKeyframe.
area
- 添加 area 标记到该复合视图。
timingKeyframe.
line
- 添加 line 标记到该复合视图。
timingKeyframe.
vector
- 添加 vector 标记到该复合视图。
timingKeyframe.
link
- 添加 link 标记到该复合视图。
timingKeyframe.
polygon
- 添加 polygon 标记到该复合视图。
timingKeyframe.
image
- 添加 image 标记到该复合视图。
timingKeyframe.
text
- 添加 text 标记到该复合视图。
timingKeyframe.
lineX
- 添加 lineX 标记到该复合视图。
timingKeyframe.
lineY
- 添加 lineY 标记到该复合视图。
timingKeyframe.
range
- 添加 range 标记到该复合视图。
timingKeyframe.
rangeX
- 添加 rangeX 标记到该复合视图。
timingKeyframe.
rangeY
- 添加 rangeY 标记到该复合视图。
timingKeyframe.
connector
- 添加 connector 标记到该复合视图。
timingKeyframe.
sankey
- 添加 sankey 标记到该复合视图。
timingKeyframe.
treemap
- 添加 treemap 标记到该复合视图。
timingKeyframe.
boxplot
- 添加 boxplot 标记到该复合视图。
timingKeyframe.
shape
- 添加 shape 标记到该复合视图。
timingKeyframe.
pack
- 添加 pack 标记到该复合视图。
timingKeyframe.
forceGraph
- 添加 forceGraph 标记到该视图。
timingKeyframe.
tree
- 添加 tree 标记到该视图。
timingKeyframe.
wordCloud
- 添加 wordCloud 标记到该视图。
timingKeyframe.
gauge
- 添加 gauge 标记到该视图。
设置属性
timingKeyframe.
attr
- 设置或获取该复合视图的属性。