You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2022/04/23 14:05:50 UTC

[echarts-doc] 01/01: fix(formatter): sync en formatter doc from zh

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

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

commit 5f9040c7c167058e84a9969e23c8f3bb9a86825b
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Sat Apr 23 22:04:40 2022 +0800

    fix(formatter): sync en formatter doc from zh
---
 en/option/partial/formatter.md | 40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/en/option/partial/formatter.md b/en/option/partial/formatter.md
index b45af349..4f1f6e72 100644
--- a/en/option/partial/formatter.md
+++ b/en/option/partial/formatter.md
@@ -33,6 +33,44 @@
     // Only work in `radar` series.
     dimensionIndex: number,
     // Color of data
-    color: string,
+    color: string{{ for: ${extra} as ${obj}, ${name} }}{{ if: ${extra}.hasOwnProperty(${name}) }},
+    // ${obj.desc}
+    ${name}: ${obj.type}{{ /if }}{{ /for }}
 }
 ```
+
+**How to use `encode` and `dimensionNames`?**
+
+When the dataset is like
+```ts
+dataset: {
+    source: [
+        ['Matcha Latte', 43.3, 85.8, 93.7],
+        ['Milk Tea', 83.1, 73.4, 55.1],
+        ['Cheese Cocoa', 86.4, 65.2, 82.5],
+        ['Walnut Brownie', 72.4, 53.9, 39.1]
+    ]
+}
+```
+We can get the value of the y-axis via
+```ts
+params.value[params.encode.y[0]]
+```
+
+When the dataset is like
+```ts
+dataset: {
+    dimensions: ['product', '2015', '2016', '2017'],
+    source: [
+        {product: 'Matcha Latte', '2015': 43.3, '2016': 85.8, '2017': 93.7},
+        {product: 'Milk Tea', '2015': 83.1, '2016': 73.4, '2017': 55.1},
+        {product: 'Cheese Cocoa', '2015': 86.4, '2016': 65.2, '2017': 82.5},
+        {product: 'Walnut Brownie', '2015': 72.4, '2016': 53.9, '2017': 39.1}
+    ]
+}
+```
+We can get the value of the y-axis via
+```ts
+params.value[params.dimensionNames[params.encode.y[0]]]
+```
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org