antvis/G2



The issue has been closed
有计划支持图形(文本等其他元素也算)层叠顺序的控制吗? #3757
zhujudong posted onGitHub
- I have searched the issues of this repository and believe that this is not a duplicate.
What problem does this feature solve?
背景:需要灵活设置X轴标签位置,当标签设置在图形内时,标签会被图形覆盖(如下图)
对应配置:
import { Chart } from '@antv/g2';
const data = [
{ year: '1991', value: 3 },
{ year: '1992', value: 4 },
{ year: '1993', value: 3.5 },
{ year: '1994', value: 5 },
{ year: '1995', value: 4.9 },
];
const chart = new Chart({
container: 'container',
autoFit: true,
height: 500,
});
chart.data(data);
chart.tooltip({
showMarkers: false
});
chart
.interval()
.position('year*value')
.color('year');
// 设置X轴位置偏移
chart.axis('year',{
label:{
offset: -15,
style:{
fill: '#000'
},
},
})
chart.interaction('element-highlight');
chart.interaction('element-list-highlight');
chart.interaction('legend-highlight');
chart.interaction('axis-label-highlight');
chart.render();
期望解决方案:提供控制层叠循序的配置
What does the proposed API look like?
<!-- generated by antv-issue-helper. DO NOT REMOVE -->