]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix inconsistent aspect ratio
authorJerome Touffe-Blin <jtblin@gmail.com>
Sun, 26 Mar 2017 02:44:26 +0000 (13:44 +1100)
committerEvert Timberg <evert.timberg+github@gmail.com>
Sun, 4 Jun 2017 13:41:13 +0000 (09:41 -0400)
src/controllers/controller.doughnut.js
src/controllers/controller.polarArea.js
src/controllers/controller.radar.js
test/specs/platform.dom.tests.js

index 3d478058279dbe49eecbab269e7909a3193fdea8..2abac3b987331f99368dfd2bf2ab40dec26f5c33 100644 (file)
@@ -12,7 +12,6 @@ module.exports = function(Chart) {
                        // Boolean - Whether we animate scaling the Doughnut from the centre
                        animateScale: false
                },
-               aspectRatio: 1,
                hover: {
                        mode: 'single'
                },
index 7db8935b31773ff7028a888155943448122bc21f..ecf2ac62cc1d4ea8965d917c7c7106836ca40561 100644 (file)
@@ -29,7 +29,6 @@ module.exports = function(Chart) {
                },
 
                startAngle: -0.5 * Math.PI,
-               aspectRatio: 1,
                legendCallback: function(chart) {
                        var text = [];
                        text.push('<ul class="' + chart.id + '-legend">');
index 2f73b3cc1d2e658af0fe3ebdb0ea44f52a925514..9a69a6bcab67e1df0a1ae6ddcf4f89b5c572382a 100644 (file)
@@ -5,7 +5,6 @@ module.exports = function(Chart) {
        var helpers = Chart.helpers;
 
        Chart.defaults.radar = {
-               aspectRatio: 1,
                scale: {
                        type: 'radialLinear'
                },
index 7ca768307e1b810298a7ea35b1ae2a89b4667917..fa01fc566175cb33d91a4f3ad13e2727086558b4 100644 (file)
@@ -122,6 +122,9 @@ describe('Platform.dom', function() {
                });
 
                it('should use default "chart" aspect ratio for render and display sizes', function() {
+                       var ratio = Chart.defaults.doughnut.aspectRatio;
+                       Chart.defaults.doughnut.aspectRatio = 1;
+
                        var chart = acquireChart({
                                type: 'doughnut',
                                options: {
@@ -133,6 +136,8 @@ describe('Platform.dom', function() {
                                }
                        });
 
+                       Chart.defaults.doughnut.aspectRatio = ratio;
+
                        expect(chart).toBeChartOfSize({
                                dw: 425, dh: 425,
                                rw: 425, rh: 425,