Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support round cap for polar bars #11393

Merged
merged 11 commits into from Oct 18, 2019
31 changes: 18 additions & 13 deletions src/component/axis/AngleAxisView.js
Expand Up @@ -96,19 +96,24 @@ export default AxisView.extend({
_axisLine: function (angleAxisModel, polar, ticksAngles, radiusExtent) {
var lineStyleModel = angleAxisModel.getModel('axisLine.lineStyle');

var circle = new graphic.Circle({
shape: {
cx: polar.cx,
cy: polar.cy,
r: radiusExtent[getRadiusIdx(polar)]
},
style: lineStyleModel.getLineStyle(),
z2: 1,
silent: true
});
circle.style.fill = null;

this.group.add(circle);
for (var rx = 0; rx < radiusExtent.length; ++rx) {
// Draw a circle for radius like [0, 100], and two circles for [20, 100]
if (radiusExtent[rx] > 0) {
var circle = new graphic.Circle({
shape: {
cx: polar.cx,
cy: polar.cy,
r: radiusExtent[rx]
},
style: lineStyleModel.getLineStyle(),
z2: 1,
silent: true
});
circle.style.fill = null;

this.group.add(circle);
}
}
},
Ovilia marked this conversation as resolved.
Show resolved Hide resolved

/**
Expand Down
19 changes: 16 additions & 3 deletions src/coord/polar/polarCreator.js
Expand Up @@ -47,10 +47,23 @@ function resizePolar(polar, polarModel, api) {

var radiusAxis = polar.getRadiusAxis();
var size = Math.min(width, height) / 2;
var radius = parsePercent(polarModel.get('radius'), size);

var radius = polarModel.get('radius');
if (radius == null) {
radius = [0, "100%"];
}
else if (typeof radius === 'number' || typeof radius === 'string') {
Ovilia marked this conversation as resolved.
Show resolved Hide resolved
// r0 = 0
radius = [0, radius];
}
radius = [
parsePercent(radius[0], size),
parsePercent(radius[1], size)
];

radiusAxis.inverse
? radiusAxis.setExtent(radius, 0)
: radiusAxis.setExtent(0, radius);
? radiusAxis.setExtent(radius[1], radius[0])
: radiusAxis.setExtent(radius[0], radius[1]);
}

/**
Expand Down