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

radialLinear: fix getIndexAngle when there are no labels (left) #10020

Merged
merged 7 commits into from Dec 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/controllers/controller.polarArea.js
@@ -1,7 +1,6 @@
import DatasetController from '../core/core.datasetController';
import {toRadians, PI} from '../helpers/index';
import {formatNumber} from '../helpers/helpers.intl';
import {isNumber} from '../helpers/helpers.math';

export default class PolarAreaController extends DatasetController {

Expand Down Expand Up @@ -58,11 +57,7 @@ export default class PolarAreaController extends DatasetController {
const centerX = scale.xCenter;
const centerY = scale.yCenter;

if (isNumber(scale.getIndexAngle(0))) {
this._lastIndexAngle = scale.getIndexAngle(0);
}

const datasetStartAngle = this._lastIndexAngle - 0.5 * PI;
const datasetStartAngle = scale.getIndexAngle(0) - 0.5 * PI;
let angle = datasetStartAngle;
let i;

Expand Down
4 changes: 3 additions & 1 deletion src/scales/scale.radialLinear.js
Expand Up @@ -373,7 +373,9 @@ export default class RadialLinearScale extends LinearScaleBase {
getIndexAngle(index) {
const angleMultiplier = TAU / this._pointLabels.length;
LeeLenaleee marked this conversation as resolved.
Show resolved Hide resolved
const startAngle = this.options.startAngle || 0;
return _normalizeAngle(index * angleMultiplier + toRadians(startAngle));
const indexAngle = _normalizeAngle(index * angleMultiplier + toRadians(startAngle));

return this._pointLabels.length === 0 ? startAngle : indexAngle;
LeeLenaleee marked this conversation as resolved.
Show resolved Hide resolved
}

getDistanceFromCenterForValue(value) {
Expand Down