]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Add minRotation support 2505/head
authorTom Duncalf <tom@tomduncalf.com>
Tue, 10 May 2016 11:10:01 +0000 (12:10 +0100)
committerTom Duncalf <tom@tomduncalf.com>
Tue, 10 May 2016 11:33:36 +0000 (12:33 +0100)
src/core/core.scale.js
test/core.helpers.tests.js
test/scale.category.tests.js
test/scale.linear.tests.js
test/scale.logarithmic.tests.js
test/scale.radialLinear.tests.js
test/scale.time.tests.js

index 142890e1baef501c2b0847bb3c442dbf3e8d07f1..6993c91041499324637d9667cc73a5bc9b5fca36 100644 (file)
@@ -33,6 +33,7 @@ module.exports = function(Chart) {
                // label settings
                ticks: {
                        beginAtZero: false,
+                       minRotation: 0,
                        maxRotation: 50,
                        mirror: false,
                        padding: 10,
@@ -190,7 +191,7 @@ module.exports = function(Chart) {
                        var lastWidth = this.ctx.measureText(this.ticks[this.ticks.length - 1]).width;
                        var firstRotated;
 
-                       this.labelRotation = 0;
+                       this.labelRotation = this.options.ticks.minRotation || 0;
                        this.paddingRight = 0;
                        this.paddingLeft = 0;
 
index 1073928442fa6d7efb118e26efc652431ba63f5a..9b452515ec28c72aebff2af6d25df2a6477d4377 100644 (file)
@@ -231,6 +231,7 @@ describe('Core helper tests', function() {
                                        },
                                        ticks: {
                                                beginAtZero: false,
+                                               minRotation: 0,
                                                maxRotation: 50,
                                                mirror: false,
                                                padding: 10,
@@ -262,6 +263,7 @@ describe('Core helper tests', function() {
                                        },
                                        ticks: {
                                                beginAtZero: false,
+                                               minRotation: 0,
                                                maxRotation: 50,
                                                mirror: false,
                                                padding: 10,
index c26a875c24f662e0af5c130525463b248c930c28..4688f51d879df57ebbcf19d5371be113ee7010f0 100644 (file)
@@ -30,6 +30,7 @@ describe('Category scale tests', function() {
                        },
                        ticks: {
                                beginAtZero: false,
+                               minRotation: 0,
                                maxRotation: 50,
                                mirror: false,
                                padding: 10,
index 8785ed2f3295305f6f74945936355a24149c4d5d..afcce0af2fa83a8d750a64dd7107303f343909f3 100644 (file)
@@ -41,6 +41,7 @@ describe('Linear Scale', function() {
                        },
                        ticks: {
                                beginAtZero: false,
+                               minRotation: 0,
                                maxRotation: 50,
                                mirror: false,
                                padding: 10,
@@ -633,7 +634,7 @@ describe('Linear Scale', function() {
                                }
                        }
                });
-               
+
                var xScale = chartInstance.scales.xScale0;
                expect(xScale.getPixelForValue(1, 0, 0)).toBeCloseToPixel(501); // right - paddingRight
                expect(xScale.getPixelForValue(-1, 0, 0)).toBeCloseToPixel(41); // left + paddingLeft
index 4fcfc691da44fac0f91bb255d95a5ebed3034d5d..3b01fd2404a319cc76b9f1f69abcece931d6de18 100644 (file)
@@ -36,6 +36,7 @@ describe('Logarithmic Scale tests', function() {
                        },
                        ticks: {
                                beginAtZero: false,
+                               minRotation: 0,
                                maxRotation: 50,
                                mirror: false,
                                padding: 10,
index a63c7ee78c9fe7a3eaf6b2a4d076a5110472c99a..2e0d7b6721f3487b9b2839dcb085063c7de52042 100644 (file)
@@ -54,6 +54,7 @@ describe('Test the radial linear scale', function() {
                                backdropPaddingY: 2,
                                backdropPaddingX: 2,
                                beginAtZero: false,
+                               minRotation: 0,
                                maxRotation: 50,
                                mirror: false,
                                padding: 10,
index 5267a2b86385fb713b227629423b43259d28eff3..207a11a693fbd4a9298aaa697c7837aa2284ff5c 100644 (file)
@@ -63,6 +63,7 @@ describe('Time scale tests', function() {
                        },
                        ticks: {
                                beginAtZero: false,
+                               minRotation: 0,
                                maxRotation: 50,
                                mirror: false,
                                padding: 10,