Do you want to work on this issue?
You can request for a bounty in order to promote it!
使用facetRect() 做横向排列的对比直方图时,从第二个直方图起无法去掉Y轴label,而且Color 标题不能取消 #6135
EWChina999 posted onGitHub
问题描述
使用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'; ,import { Histogram } from '@ant-design/plots'; ant-design/plots Histogram 没法水平排列,也就是直方图的每一个长方格与X轴平行