mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
Fix ticks.mirror (#8482)
This commit is contained in:
parent
aa69892823
commit
5285735c0f
@ -1524,6 +1524,11 @@ export default class Scale extends Element {
|
||||
*/
|
||||
_computeLabelArea() {
|
||||
const me = this;
|
||||
|
||||
if (me.options.ticks.mirror) {
|
||||
return;
|
||||
}
|
||||
|
||||
const chart = me.chart;
|
||||
const position = me.options.position;
|
||||
|
||||
@ -1532,8 +1537,6 @@ export default class Scale extends Element {
|
||||
} if (position === 'top' || position === 'bottom') {
|
||||
return {top: me.top, left: 0, bottom: me.bottom, right: chart.width};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
27
test/fixtures/core.scale/ticks-mirror.js
vendored
Normal file
27
test/fixtures/core.scale/ticks-mirror.js
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
module.exports = {
|
||||
config: {
|
||||
type: 'line',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [1, -1, 3],
|
||||
}],
|
||||
labels: ['Label1', 'Label2', 'Label3']
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
y: {
|
||||
ticks: {
|
||||
mirror: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
options: {
|
||||
spriteText: true,
|
||||
canvas: {
|
||||
height: 256,
|
||||
width: 512
|
||||
}
|
||||
}
|
||||
};
|
BIN
test/fixtures/core.scale/ticks-mirror.png
vendored
Normal file
BIN
test/fixtures/core.scale/ticks-mirror.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Loading…
Reference in New Issue
Block a user