You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2019/10/24 18:24:54 UTC

[incubator-echarts-doc] branch master updated: fix: clarify dataZoom.rangeMode.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 2843a60  fix: clarify dataZoom.rangeMode.
2843a60 is described below

commit 2843a60aab54a9d4f0b77e24788a77845b9d93ea
Author: SHUANG SU <su...@gmail.com>
AuthorDate: Fri Oct 25 02:24:38 2019 +0800

    fix: clarify dataZoom.rangeMode.
---
 en/option/component/data-zoom.md | 14 ++++++++++++++
 zh/option/component/data-zoom.md | 15 +++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/en/option/component/data-zoom.md b/en/option/component/data-zoom.md
index d06f6ac..4fa6660 100644
--- a/en/option/component/data-zoom.md
+++ b/en/option/component/data-zoom.md
@@ -228,6 +228,8 @@ The start percentage of the window out of the data extent, in the range of 0 ~ 1
 
 [${dataZoomName}.start](~${dataZoomName}.start) and [${dataZoomName}.end](~${dataZoomName}.end) define the window of the data in **percent** form.
 
+More info about the relationship between `${dataZoomName}.start` and axis extent can be checked in [${dataZoomName}.rangeMode](~${dataZoomName}.rangeMode).
+
 
 ## end(number) = 100
 
@@ -235,6 +237,8 @@ The end percentage of the window out of the data extent, in the range of 0 ~ 100
 
 [${dataZoomName}.start](~${dataZoomName}.start) and [${dataZoomName}.end](~${dataZoomName}.end) define the window of the data in **percent** form.
 
+More info about the relationship between `${dataZoomName}.end` and axis extent can be checked in [${dataZoomName}.rangeMode](~${dataZoomName}.rangeMode).
+
 
 ## startValue(number|string|Date) = null
 
@@ -244,6 +248,8 @@ The start absolute value of the window, not works when [${dataZoomName}.start](~
 
 Notice, if an axis is set to be `category`, `startValue` could be set as `index` of the array of `axis.data` or as the array value itself. In the latter case, it will internally and automatically translate to the index of array.
 
+More info about the relationship between `${dataZoomName}.startValue` and axis extent can be checked in [${dataZoomName}.rangeMode](~${dataZoomName}.rangeMode).
+
 
 ## endValue(number|string|Date) = null
 
@@ -253,6 +259,8 @@ The end absolute value of the window, not works when [${dataZoomName}.end](~${da
 
 Notice, if an axis is set to be `category`, `startValue` could be set as `index` of the array of `axis.data` or as the array value itself. In the latter case, it will internally and automatically translate to the index of array.
 
+More info about the relationship between `${dataZoomName}.endValue` and axis extent can be checked in [${dataZoomName}.rangeMode](~${dataZoomName}.rangeMode).
+
 
 ## minSpan(number) = null
 
@@ -315,6 +323,12 @@ For example `rangeMode: ['value', 'percent']` means that use absolute value in `
 
 Optional value: `'value'`, `'percent'`.
 
++ `'value'` mode: the axis extent will always only be determined by `dataZoom.startValue` and `dataZoom.endValue`, despite how data like and how `axis.min` and `axis.max` are.
++ `'percent'` mode: `100` represents 100% of the `[dMin, dMax]`, where `dMin` is `axis.min` if `axis.min` specified, otherwise `data.extent[0]`, and `dMax` is `axis.max` if `axis.max` specified, otherwise `data.extent[1]`. Axis extent will only be determined by the result of the percent of `[dMin, dMax]`.
+
+By default `rangeMode` are auto determined by whether `option.start`/`option.end` are specified (represents `'percent'` mode) or `option.startValue`/`option.endValue` specified (represents `'value'` mode). And when user behavior trigger the changing of the view, the `rangeMode` would be modified automatically. For example, if triggered by `toolbox.dataZoom`, it will be modefied to `'value'`, and if triggered by `dataZoom-inside` or `dataZoom-slider`, it will be modified to `'percent'`. B [...]
+
+Take a scenario as an example. When we are using dynamic data (update data periodically via `setOption`), if in `'value`' mode, the window will be kept in a fixed value range despite how data are appended, while if in `'percent'` mode, whe window range will be changed alone with the appended data (suppose `axis.min` and `axis.max` are not specified).
 
 
 {{target: partial-data-zoom-filterMode}}
diff --git a/zh/option/component/data-zoom.md b/zh/option/component/data-zoom.md
index cc7c86d..9047e74 100644
--- a/zh/option/component/data-zoom.md
+++ b/zh/option/component/data-zoom.md
@@ -219,6 +219,8 @@ option: {
 
 [${dataZoomName}.start](~${dataZoomName}.start) 和 [${dataZoomName}.end](~${dataZoomName}.end) 共同用 **百分比** 的形式定义了数据窗口范围。
 
+关于坐标轴范围(axis extent)和 `${dataZoomName}.start` 的关系的更多信息,请参见:[${dataZoomName}.rangeMode](~${dataZoomName}.rangeMode)。
+
 
 ## end(number) = 100
 
@@ -226,6 +228,8 @@ option: {
 
 [${dataZoomName}.start](~${dataZoomName}.start) 和 [${dataZoomName}.end](~${dataZoomName}.end) 共同用 **百分比** 的形式定义了数据窗口范围。
 
+关于坐标轴范围(axis extent)和 `${dataZoomName}.end` 的关系的更多信息,请参见:[${dataZoomName}.rangeMode](~${dataZoomName}.rangeMode)。
+
 
 ## startValue(number|string|Date) = null
 
@@ -236,6 +240,8 @@ option: {
 注意,如果轴的类型为 `category`,则 `startValue` 既可以设置为 `axis.data` 数组的 `index`,也可以设置为数组值本身。
 但是如果设置为数组值本身,会在内部自动转化为数组的 index。
 
+关于坐标轴范围(axis extent)和 `${dataZoomName}.startValue` 的关系的更多信息,请参见:[${dataZoomName}.rangeMode](~${dataZoomName}.rangeMode)。
+
 
 ## endValue(number|string|Date) = null
 
@@ -246,6 +252,9 @@ option: {
 注意,如果轴的类型为 `category`,则 `endValue` 即可以设置为 `axis.data` 数组的 `index`,也可以设置为数组值本身。
 但是如果设置为数组值本身,会在内部自动转化为数组的 index。
 
+关于坐标轴范围(axis extent)和 `${dataZoomName}.endValue` 的关系的更多信息,请参见:[${dataZoomName}.rangeMode](~${dataZoomName}.rangeMode)。
+
+
 ## minSpan(number) = null
 
 用于限制窗口大小的最小值(百分比值),取值范围是 `0` ~ `100`。
@@ -304,6 +313,12 @@ option: {
 
 可选值为:`'value'`, `'percent'`
 
++ `'value'` 模式:处于此模式下,坐标轴范围(axis extent)总只会被`dataZoom.startValue` and `dataZoom.endValue` 决定,而不管数据是多少,以及不管,`axis.min` 和 `axis.max` 怎么设置。
++ `'percent'` 模式:处于此模式下,`100` 代表 100% 的 `[dMin, dMax]`。这里 `dMin` 表示,如果 `axis.min` 设置了就是 `axis.min`,否则是 `data.extent[0]`;`dMax` 表示,如果 `axis.max` 设置了就是 `axis.max`,否则是 `data.extent[1]`。`[dMin, dMax]` 乘以 percent 的结果得到坐标轴范围(axis extent)。
+
+默认情况下,`rangeMode` 总是被自动设定。如果指定了 `option.start`/`option.end` 那么就设定为 `'percent'`,如果指定了 `option.startValue`/`option.endValue` 那么就设定为 `'value'`。以及当用户用不用操作触发视图改变时,`rangeMode` 也可能会相应得变化(如,通过 `toolbox.dataZoom` 触发视图改变时,`rangeMode` 会自动被设置为 `value`,通过 `dataZoom-inside` 和 `dataZoom-slider` 触发视图改变时,会自动被设置为 `'percent'`)。而一旦我们手动在 `option` 中设定了 `rangeMode`,那么它就不会改变永远是这个值。所以,大多数情况下,我们不需要手动设定 `dataZoom.rangeMode`,除非我们确切知道设定它带来的影响。
+
+举例一个使用场景:当我们使用动态数据时(即,周期性得通过 `setOption` 来改变数据),如果 `rangeMode` 在 `'value`' 模式,`dataZoom` 的窗口会一直保持在一个固定的值区间,无论数据怎么改变添加了多少;如果 `rangeMode` 在 `'percent'` 模式,窗口会随着数据的添加而改变(假设 `axis.min` 和 `axis.max` 没有被设置)。
 
 
 {{target: partial-data-zoom-filterMode}}


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