提交 56c93b6f 编写于 作者: O Ovilia

feat(radar): support `radius: [r0, r1]` form #8717

上级 b8914a9c
......@@ -66,6 +66,11 @@ function Radar(radarModel, ecModel, api) {
* @readOnly
*/
this.r;
/**
* @type {number}
* @readOnly
*/
this.r0;
/**
* @type {number}
* @readOnly
......@@ -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));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册