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/25 17:04:52 UTC

[incubator-echarts-doc] branch master updated: enhance: tweak 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 adef2e8  enhance: tweak rangeMode
adef2e8 is described below

commit adef2e80d25dc591fff4749991e715fa2bd40af8
Author: SHUANG SU <su...@gmail.com>
AuthorDate: Sat Oct 26 01:04:34 2019 +0800

    enhance: tweak rangeMode
---
 en/option/component/data-zoom.md | 8 ++++++--
 zh/option/component/data-zoom.md | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/en/option/component/data-zoom.md b/en/option/component/data-zoom.md
index 4fa6660..49fc3f0 100644
--- a/en/option/component/data-zoom.md
+++ b/en/option/component/data-zoom.md
@@ -319,14 +319,18 @@ If [animation](~animation) set as `false` or [animationDurationUpdate](~animatio
 
 ## rangeMode(Array)
 
+The format is `[rangeModeForStart, rangeModeForEnd]`.
+
 For example `rangeMode: ['value', 'percent']` means that use absolute value in `start` and percent value in `end`.
 
-Optional value: `'value'`, `'percent'`.
+Optional value for each item: `'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 [...]
+`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'`.
+
+If we specify `rangeMode` manually in `option`, it only works when both `start` and `startValue` specified or both `end` and `endValue` specified. So usually we do not need to specify `dataZoom.rangeMode` manually.
 
 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).
 
diff --git a/zh/option/component/data-zoom.md b/zh/option/component/data-zoom.md
index 9047e74..e311317 100644
--- a/zh/option/component/data-zoom.md
+++ b/zh/option/component/data-zoom.md
@@ -309,14 +309,18 @@ option: {
 
 ## rangeMode(Array)
 
+形式为:`[rangeModeForStart, rangeModeForEnd]`。
+
 例如 `rangeMode: ['value', 'percent']`,表示 start 值取绝对数值,end 取百分比。
 
-可选值为:`'value'`, `'percent'`
+每项可选值为:`'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`,除非我们确切知道设定它带来的影响。
+默认情况下,`rangeMode` 总是被自动设定。如果指定了 `option.start`/`option.end` 那么就设定为 `'percent'`,如果指定了 `option.startValue`/`option.endValue` 那么就设定为 `'value'`。以及当用户用不用操作触发视图改变时,`rangeMode` 也可能会相应得变化(如,通过 `toolbox.dataZoom` 触发视图改变时,`rangeMode` 会自动被设置为 `value`,通过 `dataZoom-inside` 和 `dataZoom-slider` 触发视图改变时,会自动被设置为 `'percent'`)。
+
+如果我们手动在 `option` 中设定了 `rangeMode`,那么它只在 `start` 和 `startValue` 都设置了或者 `end` 和 `endValue` 都设置了才有意义。所以通常我们没必要在 `option` 中指定 `rangeMode`。
 
 举例一个使用场景:当我们使用动态数据时(即,周期性得通过 `setOption` 来改变数据),如果 `rangeMode` 在 `'value`' 模式,`dataZoom` 的窗口会一直保持在一个固定的值区间,无论数据怎么改变添加了多少;如果 `rangeMode` 在 `'percent'` 模式,窗口会随着数据的添加而改变(假设 `axis.min` 和 `axis.max` 没有被设置)。
 


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