简体   繁体   English

Amcharts5 图例垂直对齐不起作用

[英]Amcharts5 legend vertical align doesn't work

I am new to Amcharts5.我是 Amcharts5 的新手。 This is my XY chart which has 3 series:这是我的 XY 图表,它有 3 个系列:

var chart3 = root3.container.children.push(
  am5xy.XYChart.new(root3, {
    layout: root3.horizontalLayout
  }),
);

I'm trying to put a legend on the top right of my XY chart, and I followed an official doc.我试图在我的 XY 图表的右上角放置一个图例,并且我遵循了官方文档。 This is my configuration for a vertical alignment( which is exactly the same as in the offical doc):这是我的垂直对齐配置(与官方文档中的完全相同):

var legend = chart3.children.push(
  am5.Legend.new(root3, {
    centerY: am5.percent(0),
    y: am5.percent(0),
  })
);

And here is the output: XY Chart with Legend I really don't know why it doesn't work...这是 output:带有图例的 XY 图表我真的不知道为什么它不起作用......

Have you tried setting centerX and x also manually?您是否尝试过手动设置 centerX 和 x ?

var legend = chart3.children.push(
  am5.Legend.new(root3, {
    centerX: am5.percent(100),
    x: am5.percent(100),
    centerY: am5.percent(0),
    y: am5.percent(0),
  })
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM