antvis/G2






The issue has been closed
Bug: spaceFlex 模式下 chart 的 autoFit 配置无效 #5783
lxfu1 posted onGitHub
AntV Open Source Contribution Plan(可选)
- 我同意将这个 Issue 参与 OSCP 计划
Issue 类型
初级任务
任务介绍
spaceFlex 模式下 chart 的 autoFit 配置无效,修复这个问题:
import { Chart } from '@antv/g2';
const chart = new Chart({
container: 'container',
autoFit: true,
direction: 'col',
});
chart.options({
type: 'spaceFlex',
children: [
{
type: 'interval',
axis: {
x: {
position: 'right',
title: false,
},
y: {
title: false,
},
},
data: [
{
country: '乌拉圭',
'2016年耕地总面积': -13.4,
'2016年转基因种植面积': 12.3,
},
{
country: '巴拉圭',
'2016年耕地总面积': -14.4,
'2016年转基因种植面积': 6.3,
},
],
coordinate: {
transform: [
{
type: 'transpose',
},
],
},
scale: {
y: {
nice: true,
},
},
tooltip: {
items: [
{
channel: 'y',
},
],
},
interaction: {
tooltip: {
shared: true,
},
},
encode: {
x: 'country',
y: '2016年耕地总面积',
},
},
{
type: 'interval',
paddingLeft: 0,
axis: {
x: {
label: false,
title: false,
},
y: {
title: false,
},
},
data: [
{
country: '乌拉圭',
'2016年耕地总面积': 13.4,
'2016年转基因种植面积': 12.3,
},
{
country: '巴拉圭',
'2016年耕地总面积': 14.4,
'2016年转基因种植面积': 6.3,
},
],
coordinate: {
transform: [
{
type: 'transpose',
},
],
},
scale: {
y: {
nice: true,
},
},
tooltip: {
items: [
{
channel: 'y',
},
],
},
interaction: {
tooltip: {
shared: true,
},
},
encode: {
x: 'country',
y: '2016年转基因种植面积',
},
},
],
});
chart.render();