antvis/G2

The issue has been closed
分面 是否支持展示所有子图的坐标轴 #6237
BubbleLM posted onGitHub
问题描述
import { Chart } from '@antv/g2';
const Data = new Array(100).fill().map((item, index) => {
return {
year: 1990 + index + '',
value: Math.ceil(Math.random() * 20),
type: 'cat ' + (index % 10),
};
})
const chart = new Chart({
container: 'container',
autoFit: true,
height: 400,
padding: 20
});
chart.data(Data);
chart.scale({
value: {
sync: true,
nice: true
},
type: {
sync: true,
},
});
chart.facet('list', {
fields: [ 'type' ],
cols: 3,
padding: 15,
showTitle: true,
eachView(view, facet) {
view.axis('year', {
label: {
style: {
fill: '#333'
}
},
line: null,
tickLine: null,
title: {
text: 'X轴',
style: {
fontSize: 12,
fill: '#333'
}
}
})
view.axis('value', {
label: {
style: {
fill: '#333'
}
},
line: null,
tickLine: null,
title: {
text: 'y轴',
style: {
fontSize: 12,
fill: '#333'
}
}
})
view.point()
//.axis(false)
.position('year*value')
.color('cut')
.shape('circle')
.style({ fillOpacity: 0.3, stroke: null })
.size(2);
}
});
chart.render();
重现链接
No response
重现步骤
No response
预期行为
实际效果: <img width="1194" alt="image" src="https://github.com/antvis/G2/assets/153375424/2a50b081-6d2b-4522-8887-90c3a86e8516">
当前y轴仅会在每行展示,期望每个子图都能展示自己的坐标轴。期望效果如下: <img width="956" alt="image" src="https://github.com/antvis/G2/assets/153375424/54075dad-8d0c-49e9-a9cc-769fe00f1574">
平台
- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox]
屏幕截图或视频(可选)
No response
补充说明(可选)
No response