Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用facetRect() 做横向排列的对比直方图时,从第二个直方图起无法去掉Y轴label,而且Color 标题不能取消 #6135

Open
EWChina999 opened this issue Mar 17, 2024 · 1 comment

Comments

@EWChina999
Copy link

问题描述

使用facetRect() 做横向排列的对比直方图时,从第二个直方图起无法去掉Y轴label,而且Color 标题不能取消,目的是为了节省视图空间。在制造行业,为了做设备之间工艺参数性能对比,横向排列的对比直方图 (也就是直方图的每一个长方格与X轴平行)非常有用。

重现链接

https://g2.antv.antgroup.com/examples/analysis/bin/#binx

重现步骤

进入 https://g2.antv.antgroup.com/examples/analysis/bin/#binx , 使用如下代码 import { Chart } from "@antv/g2";
const chart = new Chart({
container: "container",
paddingTop: 60,
});

const facet = chart
.facetRect() //
.data({
type: "fetch",
value: "https://gw.alipayobjects.com/os/antvdemo/assets/data/scatter.json",
})
.encode("x", "gender");

facet
.rect()
.encode("x", "height")
.encode("color", "gender")
.coordinate({ transform: [{ type: "transpose" }] })
.transform({ type: "binX", y: "count" })
.transform({ type: "stackY" })
.scale("y", { nice: true })
.axis({x:{title:false,label:true},y:{label:true}})
.attr("frame", false)
.style("insetBottom", 1); // 将 "insetLeft" 改为 "insetBottom"

chart.render();

预期行为

image
去掉红色划X的部分文字

平台

  • 操作系统: [ Windows ...]
  • 网页浏览器: [Google Chrome]

屏幕截图或视频(可选)

image

补充说明(可选)

import { Histogram } from '@ant-design/plots'; ,import { Histogram } from '@ant-design/plots'; ant-design/plots Histogram 没法水平排列,也就是直方图的每一个长方格与X轴平行

@glfeng318
Copy link

const facet = chart
.facetRect() //
.data({
type: "fetch",
value: "https://gw.alipayobjects.com/os/antvdemo/assets/data/scatter.json",
})
.encode("x", "gender")
.axis('x',{title:null});

可以隐藏gender

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants