Bar chart defaults to begin at zero (#6917)

* Bar chart defaults to begin at zero

* Add bar beginAtZero test
This commit is contained in:
Evert Timberg 2020-01-05 15:50:24 -05:00 committed by GitHub
parent 5f6c3df6dc
commit b464999851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 4 deletions

View File

@ -22,6 +22,7 @@ defaults._set('bar', {
},
y: {
type: 'linear',
beginAtZero: true,
}
}
});

View File

@ -0,0 +1,29 @@
module.exports = {
config: {
type: 'bar',
data: {
labels: [0, 1, 3, 4],
datasets: [
{
data: [5, 20, 1, 10],
backgroundColor: '#00ff00',
borderColor: '#ff0000'
}
]
},
options: {
legend: false,
title: false,
scales: {
x: {display: false},
y: {display: false}
}
}
},
options: {
canvas: {
height: 256,
width: 512
}
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -708,7 +708,8 @@ describe('Chart.controllers.bar', function() {
},
y: {
type: 'linear',
display: false
display: false,
beginAtZero: false
}
}
}
@ -773,7 +774,8 @@ describe('Chart.controllers.bar', function() {
},
y: {
type: 'linear',
display: false
display: false,
beginAtZero: false
}
}
}

View File

@ -210,7 +210,8 @@ describe('Linear Scale', function() {
options: {
scales: {
y: {
type: 'linear'
type: 'linear',
beginAtZero: false
}
}
}
@ -673,6 +674,7 @@ describe('Linear Scale', function() {
scales: {
y: {
type: 'linear',
beginAtZero: false
}
}
}
@ -751,7 +753,9 @@ describe('Linear Scale', function() {
},
options: {
scales: {
y: {}
y: {
beginAtZero: false
}
}
}
});