Skip to content

Commit

Permalink
Fix radar chart horizontal position (chartjs#4032)
Browse files Browse the repository at this point in the history
Radar chart position is not center horizontally with v2.5.0.

Right and left of `furthestLimits` would be switched wrongly on
this refactoring commit.
chartjs@e1606f8
  • Loading branch information
shirosaki authored and etimberg committed Mar 21, 2017
1 parent a27eab4 commit 4565991
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/scales/scale.radialLinear.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ module.exports = function(Chart) {
// Use this to calculate the offset + change. - Make sure L/R protrusion is at least 0 to stop issues with centre points
var largestPossibleRadius = Math.min(scale.height / 2, scale.width / 2);
var furthestLimits = {
l: scale.width,
r: 0,
r: scale.width,
l: 0,
t: scale.height,
b: 0
};
Expand Down
4 changes: 2 additions & 2 deletions test/specs/scale.radialLinear.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ describe('Test the radial linear scale', function() {
});

expect(chart.scale.drawingArea).toBe(233);
expect(chart.scale.xCenter).toBe(247);
expect(chart.scale.xCenter).toBe(256);
expect(chart.scale.yCenter).toBe(280);
});

Expand Down Expand Up @@ -393,7 +393,7 @@ describe('Test the radial linear scale', function() {
expect(chart.scale.getDistanceFromCenterForValue(chart.scale.min)).toBe(0);
expect(chart.scale.getDistanceFromCenterForValue(chart.scale.max)).toBe(233);
expect(chart.scale.getPointPositionForValue(1, 5)).toEqual({
x: 261,
x: 270,
y: 275,
});

Expand Down

0 comments on commit 4565991

Please sign in to comment.