V5 legend居右时显示不全
#5211
-
5.0.12版本 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(); |
Beta Was this translation helpful? Give feedback.
Answered by
pearmini
Jun 20, 2023
Replies: 1 comment 4 replies
-
有两个方案:
|
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
dechenwj
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
有两个方案:
new Chart({ paddingRight: 100 })
手动设置间距new Chart({ padding: 'auto' })
自动计算,这个方案要等 5.0.13 发布,会在这两天发布。