mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Fix: beginAtZero for logarighmic (#7899)
This commit is contained in:
parent
c9b38b63dc
commit
ff811aaddf
@ -77,6 +77,10 @@ export default class LogarithmicScale extends Scale {
|
||||
me.min = isFinite(min) ? Math.max(0, min) : null;
|
||||
me.max = isFinite(max) ? Math.max(0, max) : null;
|
||||
|
||||
if (me.options.beginAtZero) {
|
||||
me._zero = true;
|
||||
}
|
||||
|
||||
me.handleTickRangeOptions();
|
||||
}
|
||||
|
||||
@ -159,7 +163,6 @@ export default class LogarithmicScale extends Scale {
|
||||
|
||||
me._startValue = log10(start);
|
||||
me._valueRange = log10(me.max) - log10(start);
|
||||
me._zero = me.options.beginAtZero;
|
||||
}
|
||||
|
||||
getPixelForValue(value) {
|
||||
|
||||
@ -345,7 +345,7 @@ describe('Logarithmic Scale tests', function() {
|
||||
}
|
||||
});
|
||||
|
||||
expect(chart.scales.y.min).toBe(1);
|
||||
expect(chart.scales.y.min).toBe(0.1);
|
||||
expect(chart.scales.y.max).toBe(200);
|
||||
});
|
||||
|
||||
@ -387,7 +387,7 @@ describe('Logarithmic Scale tests', function() {
|
||||
}
|
||||
});
|
||||
|
||||
expect(chart.scales.y.min).toBe(1);
|
||||
expect(chart.scales.y.min).toBe(0.1);
|
||||
expect(chart.scales.y.max).toBe(200);
|
||||
});
|
||||
|
||||
@ -517,7 +517,7 @@ describe('Logarithmic Scale tests', function() {
|
||||
type: 'bar',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [10, 5, 1, 25, 78]
|
||||
data: [10, 5, 2, 25, 78]
|
||||
}],
|
||||
labels: []
|
||||
},
|
||||
@ -659,7 +659,7 @@ describe('Logarithmic Scale tests', function() {
|
||||
type: 'bar',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [10, 5, 1, 25, 78]
|
||||
data: [10, 5, 2, 25, 78]
|
||||
}],
|
||||
labels: []
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user