【问题标题】:Amcharts5 legend vertical align doesn't workAmcharts5 图例垂直对齐不起作用
【发布时间】:2022-08-18 23:03:16
【问题描述】:

我是 Amcharts5 的新手。 这是我的 XY 图表,它有 3 个系列:

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

我试图在我的 XY 图表的右上角放置一个图例,并且我遵循了官方文档。 这是我的垂直对齐配置(与官方文档中的完全相同):

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

这是输出: XY Chart with Legend 我真的不知道为什么它不起作用...

    标签: javascript amcharts amcharts5


    【解决方案1】:

    您是否尝试过手动设置 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),
      })
    );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-19
      • 2023-03-03
      • 2018-01-13
      • 2016-07-01
      相关资源
      最近更新 更多