mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-15 04:36:51 +01:00
Merge pull request #1742 from nnnick/fix/1715
Fixes rotational animation of new arcs
This commit is contained in:
@@ -150,10 +150,11 @@
|
||||
var resetModel = {
|
||||
x: this.chart.chart.width / 2,
|
||||
y: this.chart.chart.height / 2,
|
||||
startAngle: Math.PI * -0.5, // use - PI / 2 instead of 3PI / 2 to make animations better. It means that we never deal with overflow during the transition function
|
||||
startAngle: Math.PI * -0.5, // use - PI / 2 instead of 3PI / 2 to make animations better. It means that we never deal with overflow during the transition function,
|
||||
endAngle: Math.PI * -0.5,
|
||||
circumference: (this.chart.options.animation.animateRotate) ? 0 : this.calculateCircumference(this.getDataset().data[index]),
|
||||
outerRadius: (this.chart.options.animation.animateScale) ? 0 : this.outerRadius,
|
||||
innerRadius: (this.chart.options.animation.animateScale) ? 0 : this.innerRadius,
|
||||
innerRadius: (this.chart.options.animation.animateScale) ? 0 : this.innerRadius
|
||||
};
|
||||
|
||||
helpers.extend(arc, {
|
||||
|
||||
@@ -103,36 +103,40 @@ describe('Doughnut controller tests', function() {
|
||||
x: 50,
|
||||
y: 100,
|
||||
startAngle: Math.PI * -0.5,
|
||||
endAngle: Math.PI * -0.5,
|
||||
circumference: 2.166614539857563,
|
||||
outerRadius: 49,
|
||||
innerRadius: 36.75,
|
||||
innerRadius: 36.75
|
||||
});
|
||||
|
||||
expect(chart.data.datasets[1].metaData[1]._model).toEqual({
|
||||
x: 50,
|
||||
y: 100,
|
||||
startAngle: Math.PI * -0.5,
|
||||
endAngle: Math.PI * -0.5,
|
||||
circumference: 3.2499218097863447,
|
||||
outerRadius: 49,
|
||||
innerRadius: 36.75,
|
||||
innerRadius: 36.75
|
||||
});
|
||||
|
||||
expect(chart.data.datasets[1].metaData[2]._model).toEqual({
|
||||
x: 50,
|
||||
y: 100,
|
||||
startAngle: Math.PI * -0.5,
|
||||
endAngle: Math.PI * -0.5,
|
||||
circumference: 0,
|
||||
outerRadius: 49,
|
||||
innerRadius: 36.75,
|
||||
innerRadius: 36.75
|
||||
});
|
||||
|
||||
expect(chart.data.datasets[1].metaData[3]._model).toEqual({
|
||||
x: 50,
|
||||
y: 100,
|
||||
startAngle: Math.PI * -0.5,
|
||||
endAngle: Math.PI * -0.5,
|
||||
circumference: 0.8666458159430251,
|
||||
outerRadius: 49,
|
||||
innerRadius: 36.75,
|
||||
innerRadius: 36.75
|
||||
});
|
||||
|
||||
controller.update();
|
||||
|
||||
Reference in New Issue
Block a user