mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Fix backdrop padding (#11577)
* fix for alignment inner * Add test * Remove eslint ignores * remove unecesarry config * Remove text from test
This commit is contained in:
parent
6722512744
commit
2a03e138e9
@ -1288,6 +1288,13 @@ export default class Scale extends Element {
|
||||
case 'right':
|
||||
left -= width;
|
||||
break;
|
||||
case 'inner':
|
||||
if (i === ilen - 1) {
|
||||
left -= width;
|
||||
} else if (i > 0) {
|
||||
left -= width / 2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
48
test/fixtures/core.scale/tick-backdrop-alignment-inner.js
vendored
Normal file
48
test/fixtures/core.scale/tick-backdrop-alignment-inner.js
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
module.exports = {
|
||||
config: {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
|
||||
datasets: [
|
||||
{
|
||||
label: '# of Votes',
|
||||
data: [12, 19, 3, 5, 2, 3],
|
||||
},
|
||||
{
|
||||
label: '# of Points',
|
||||
data: [7, 11, 5, 8, 3, 7],
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
y: {
|
||||
ticks: {
|
||||
display: false,
|
||||
},
|
||||
grid: {
|
||||
lineWidth: 0
|
||||
}
|
||||
},
|
||||
x: {
|
||||
position: 'top',
|
||||
ticks: {
|
||||
color: 'transparent',
|
||||
backdropColor: 'red',
|
||||
showLabelBackdrop: true,
|
||||
align: 'inner',
|
||||
},
|
||||
grid: {
|
||||
lineWidth: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
options: {
|
||||
canvas: {
|
||||
height: 256,
|
||||
width: 512
|
||||
}
|
||||
}
|
||||
};
|
||||
BIN
test/fixtures/core.scale/tick-backdrop-alignment-inner.png
vendored
Normal file
BIN
test/fixtures/core.scale/tick-backdrop-alignment-inner.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Loading…
x
Reference in New Issue
Block a user