This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-doc.git


The following commit(s) were added to refs/heads/master by this push:
     new dc44c26  add use api
dc44c26 is described below

commit dc44c2642c27c5be587f97155b972267c40c27fe
Author: pissang <[email protected]>
AuthorDate: Thu Jan 21 16:12:57 2021 +0800

    add use api
---
 en/api/echarts.md           | 32 ++++++++++++++++++++++++++++++++
 en/tutorial/tree-shaking.md |  2 +-
 zh/api/echarts.md           | 31 +++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/en/api/echarts.md b/en/api/echarts.md
index d815ddc..362fc33 100644
--- a/en/api/echarts.md
+++ b/en/api/echarts.md
@@ -83,6 +83,36 @@ Destroys chart instance, after which the instance cannot be 
used any more.
 ```
 Returns chart instance of dom container.
 
+## use(Function)
+
+> Since `5.0.1`
+
+Use components. Used with the new tree-shaking API.
+
+```js
+// Import the echarts core module, which provides the necessary interfaces for 
using echarts.
+import * as echarts from 'echarts/core';
+// Import bar charts, all with Chart suffix
+import {
+    BarChart
+} from 'echarts/charts';
+// import rectangular coordinate system component, all suffixed with Component
+import {
+    GridComponent
+} from 'echarts/components';
+// Import the Canvas renderer, note that introducing the CanvasRenderer or 
SVGRenderer is a required step
+import {
+    CanvasRenderer
+} from 'echarts/renderers';
+
+// Register the required components
+echarts.use(
+    [GridComponent, BarChart, CanvasRenderer]
+);
+```
+
+See [Use ECharts with bundler and 
NPM](tutorial.html#Use%20ECharts%20with%20bundler%20and%20NPM) for more 
detailed explaination.
+
 ## registerMap(Function)
 ```js
 (mapName: string, geoJson: Object, specialAreas?: Object)
@@ -157,6 +187,8 @@ Registers a theme, should be specified when [initialize the 
chart instance](~ech
 
 ## registerLocale(Function)
 
+> Since `5.0.0`
+
 ```js
 (locale: string, localeCfg: Object)
 ```
diff --git a/en/tutorial/tree-shaking.md b/en/tutorial/tree-shaking.md
index 7a7d3a0..4cc5804 100644
--- a/en/tutorial/tree-shaking.md
+++ b/en/tutorial/tree-shaking.md
@@ -49,7 +49,7 @@ import * as echarts from 'echarts/core';
 import {
     BarChart
 } from 'echarts/charts';
-// import the prompt box, title, and rectangular coordinate system components, 
all suffixed with Component
+// import the tooltip, title, and rectangular coordinate system components, 
all suffixed with Component
 import {
     TitleComponent,
     TooltipComponent,
diff --git a/zh/api/echarts.md b/zh/api/echarts.md
index 99cf389..837b699 100644
--- a/zh/api/echarts.md
+++ b/zh/api/echarts.md
@@ -83,6 +83,35 @@ echarts.connect([chart1, chart2]);
 ```
 获取 dom 容器上的实例。
 
+## use(Function)
+
+> `5.0.1` 开始支持
+
+使用组件,配合新的按需引入的接口使用。
+
+```js
+// 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
+import * as echarts from 'echarts/core';
+// 引入柱状图图表,图表后缀都为 Chart
+import {
+    BarChart
+} from 'echarts/charts';
+// 引入直角坐标系组件,组件后缀都为 Component
+import {
+    GridComponent
+} from 'echarts/components';
+// 引入 Canvas 渲染器,注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
+import {
+    CanvasRenderer
+} from 'echarts/renderers';
+
+// 注册必须的组件
+echarts.use(
+    [GridComponent, BarChart, CanvasRenderer]
+);
+```
+更详细的使用方式见 [在打包环境中使用 ECharts](tutorial.html#在打包环境中使用%20ECharts) 一文
+
 ## registerMap(Function)
 ```js
 (mapName: string, geoJson: Object, specialAreas?: Object)
@@ -156,6 +185,8 @@ echarts.registerMap('USA', usaJson, {
 
 ## registerLocale(Function)
 
+> 从 `5.0.0` 开始支持
+
 ```js
 (locale: string, localeCfg: Object)
 ```


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to