mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
parent
7c8ee6e77f
commit
bedc3f1575
@ -1162,8 +1162,8 @@ export default class Scale extends Element {
|
||||
*/
|
||||
_autoSkip(ticks) {
|
||||
const me = this;
|
||||
const tickOpts = me.options.ticks;
|
||||
const ticksLimit = tickOpts.maxTicksLimit || me._length / me._tickSize();
|
||||
const {offset, ticks: tickOpts} = me.options;
|
||||
const ticksLimit = tickOpts.maxTicksLimit || (me._length / me._tickSize() + (offset ? 0 : 1));
|
||||
const majorIndices = tickOpts.major.enabled ? getMajorIndices(ticks) : [];
|
||||
const numMajorIndices = majorIndices.length;
|
||||
const first = majorIndices[0];
|
||||
|
22
test/fixtures/core.scale/autoSkip/no-offset.js
vendored
Normal file
22
test/fixtures/core.scale/autoSkip/no-offset.js
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
module.exports = {
|
||||
description: 'https://github.com/chartjs/Chart.js/issues/8611',
|
||||
config: {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: ['Red Red Red', 'Blue Blue Blue', 'Black Black Black', 'Pink Pink Pink'],
|
||||
datasets: [
|
||||
{
|
||||
label: '# of Votes',
|
||||
data: [12, 19, 3, 5]
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
options: {
|
||||
spriteText: true,
|
||||
canvas: {
|
||||
width: 470,
|
||||
height: 128
|
||||
}
|
||||
}
|
||||
};
|
BIN
test/fixtures/core.scale/autoSkip/no-offset.png
vendored
Normal file
BIN
test/fixtures/core.scale/autoSkip/no-offset.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
22
test/fixtures/core.scale/autoSkip/offset.js
vendored
Normal file
22
test/fixtures/core.scale/autoSkip/offset.js
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
module.exports = {
|
||||
description: 'https://github.com/chartjs/Chart.js/issues/8611',
|
||||
config: {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ['Red Red Red', 'Blue Blue Blue', 'Black Black Black', 'Pink Pink Pink'],
|
||||
datasets: [
|
||||
{
|
||||
label: '# of Votes',
|
||||
data: [12, 19, 3, 5]
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
options: {
|
||||
spriteText: true,
|
||||
canvas: {
|
||||
width: 506,
|
||||
height: 128
|
||||
}
|
||||
}
|
||||
};
|
BIN
test/fixtures/core.scale/autoSkip/offset.png
vendored
Normal file
BIN
test/fixtures/core.scale/autoSkip/offset.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.0 KiB |
Loading…
Reference in New Issue
Block a user