V5 legend居右时显示不全 #5210
dechenwj posted onGitHub
5.0.12版本
在 https://g2.antv.antgroup.com/zh/examples/general/line/#line-aggregated-label 这个例子里改变legend的位置 文字会显示不全 使用style itemWidth也不生效 另:不改变浏览器窗口大小 只是拖拽图表渲染区域大小的话legend不会重新计算位置 希望可以给个解决方案
`import { Chart } from "@antv/g2";
const chart = new Chart({ container: "container" });
chart.options({ type: "line", theme: "classic", autoFit: true, data: { type: "fetch", value: "https://gw.alipayobjects.com/os/bmw-prod/cb99c4ab-e0a3-4c76-9586-fe7fa2ff1a8c.csv", }, encode: { x: (d) => new Date(d.date).getFullYear(), y: "price", color: "symbol", }, transform: [{ type: "groupX", y: "mean" }], legend: { color: { position: "right", layout: { alignItems: "flex-start" } }, }, labels: [ { text: "price", transform: [{ type: "overlapDodgeY" }], style: { fontSize: 10 }, }, ], tooltip: { items: [{ channel: "y", valueFormatter: ".1f" }] }, });
chart.render(); `