使用facetRect() 做横向排列的对比直方图时,从第二个直方图起无法去掉Y轴label,而且Color 标题不能取消
- Dominant language
- TypeScript
- Stars
- 12.6k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
### 问题描述
使用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();
### 预期行为

去掉红色划X的部分文字
### 平台
- 操作系统: [ Windows ...]
- 网页浏览器: [Google Chrome]
### 屏幕截图或视频(可选)

### 补充说明(可选)
[import { Histogram } from '@ant-design/plots';](https://ant-design-charts.antgroup.com/examples/statistics/histogram/#binx) ,import { Histogram } from '@ant-design/plots'; ant-design/plots Histogram 没法水平排列,也就是直方图的每一个长方格与X轴平行
Contributor guide
Research direction
Start with the facetRect() example at the provided binx reproduction link and run the supplied TypeScript chart configuration. Investigate how the transposed, horizontally arranged facets handle axis labels and the Color title. Done means the unwanted Y-axis labels from the second histogram onward and the Color title can be disabled while preserving the comparison chart layout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100