Skip to content

Commit

Permalink
Fix drawing angle lines on reversed radial scale (#11788)
Browse files Browse the repository at this point in the history
* Fix drawing angle lines on reversed radial scale

* add test

* Show ticks in test

---------

Co-authored-by: Jacco van den Berg <jacco@jem-id.nl>
  • Loading branch information
LeeLenaleee and Jacco van den Berg authored May 24, 2024
1 parent 228a485 commit ff74078
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/scales/scale.radialLinear.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ export default class RadialLinearScale extends LinearScaleBase {
ctx.setLineDash(optsAtIndex.borderDash);
ctx.lineDashOffset = optsAtIndex.borderDashOffset;

offset = this.getDistanceFromCenterForValue(opts.ticks.reverse ? this.min : this.max);
offset = this.getDistanceFromCenterForValue(opts.reverse ? this.min : this.max);
position = this.getPointPosition(i, offset);
ctx.beginPath();
ctx.moveTo(this.xCenter, this.yCenter);
Expand Down
35 changes: 35 additions & 0 deletions test/fixtures/scale.radialLinear/anglelines-reverse-scale.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
config: {
type: 'radar',
data: {
labels: ['A', 'B', 'C', 'D', 'E'],
datasets: [{
data: [1, 1, 2, 3, 5]
}]
},
options: {
responsive: false,
scales: {
r: {
reverse: true,
grid: {
display: true,
},
angleLines: {
color: 'red',
lineWidth: 5,
},
pointLabels: {
display: false
},
ticks: {
display: true,
}
}
}
}
},
options: {
spriteText: true,
}
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ff74078

Please sign in to comment.