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

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

commit 56c93b6f366b2fddccc8ee6b302d96bd351cea44
Author: Ovilia <zwl.s...@gmail.com>
AuthorDate: Fri Aug 10 12:37:58 2018 +0800

    feat(radar): support `radius: [r0, r1]` form #8717
---
 src/coord/radar/Radar.js | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/coord/radar/Radar.js b/src/coord/radar/Radar.js
index 44d78b6..be308ca 100644
--- a/src/coord/radar/Radar.js
+++ b/src/coord/radar/Radar.js
@@ -70,6 +70,11 @@ function Radar(radarModel, ecModel, api) {
      * @type {number}
      * @readOnly
      */
+    this.r0;
+    /**
+     * @type {number}
+     * @readOnly
+     */
     this.startAngle;
 }
 
@@ -128,10 +133,16 @@ Radar.prototype.resize = function (radarModel, api) {
 
     this.startAngle = radarModel.get('startAngle') * Math.PI / 180;
 
-    this.r = numberUtil.parsePercent(radarModel.get('radius'), viewSize);
+    // radius may be single value like `20`, `'80%'`, or array like `[10, 
'80%']`
+    var radius = radarModel.get('radius');
+    if (typeof radius === 'string' || typeof radius === 'number') {
+        radius = [0, radius];
+    }
+    this.r0 = numberUtil.parsePercent(radius[0], viewSize);
+    this.r = numberUtil.parsePercent(radius[1], viewSize);
 
     zrUtil.each(this._indicatorAxes, function (indicatorAxis, idx) {
-        indicatorAxis.setExtent(0, this.r);
+        indicatorAxis.setExtent(this.r0, this.r);
         var angle = (this.startAngle + idx * Math.PI * 2 / 
this._indicatorAxes.length);
         // Normalize to [-PI, PI]
         angle = Math.atan2(Math.sin(angle), Math.cos(angle));


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

Reply via email to