mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-03 06:54:02 +01:00
when the cutoutPercentage is 0, the inner radius should be 0
This commit is contained in:
@@ -183,7 +183,7 @@ module.exports = function(Chart) {
|
||||
|
||||
chart.borderWidth = me.getMaxBorderWidth(meta.data);
|
||||
chart.outerRadius = Math.max((minSize - chart.borderWidth) / 2, 0);
|
||||
chart.innerRadius = Math.max(cutoutPercentage ? (chart.outerRadius / 100) * (cutoutPercentage) : 1, 0);
|
||||
chart.innerRadius = Math.max(cutoutPercentage ? (chart.outerRadius / 100) * (cutoutPercentage) : 0, 0);
|
||||
chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount();
|
||||
chart.offsetX = offset.x * chart.outerRadius;
|
||||
chart.offsetY = offset.y * chart.outerRadius;
|
||||
|
||||
@@ -40,6 +40,20 @@ describe('Doughnut controller tests', function() {
|
||||
expect(meta.data[3] instanceof Chart.elements.Arc).toBe(true);
|
||||
});
|
||||
|
||||
it('should set the innerRadius to 0 if the config option is 0', function() {
|
||||
var chart = window.acquireChart({
|
||||
type: 'pie',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [10, 15, 0, 4]
|
||||
}],
|
||||
labels: []
|
||||
}
|
||||
});
|
||||
|
||||
expect(chart.innerRadius).toBe(0);
|
||||
});
|
||||
|
||||
it ('should reset and update elements', function() {
|
||||
var chart = window.acquireChart({
|
||||
type: 'doughnut',
|
||||
|
||||
Reference in New Issue
Block a user