reactjs - AmCharts 5 Column Chart Apply Pattern Conditionally - Stack Overflow

I have a column chart in AmCharts 5 and i want to make some of the columns have a striped pattern based

I have a column chart in AmCharts 5 and i want to make some of the columns have a striped pattern based on some condition. I tried using template adapters but it doesn't seem to work.

series.columns.template.adapters.add("fillPattern", (pattern, target) => {
  const dataItem: any = target.dataItem;
  if (dataItem) {
    if (SOME_CONDITION) {
      return am5.LinePattern.new(root, {
        color: am5.color(COLORS.WHITE),
        rotation: 45,
        width: 200,
        height: 200,
      });
    }
  }
  // Return undefined for columns that shouldn't have a pattern
  return undefined;
});

In the documentation series.columns.template.set("fillPattern", somePattern) is used but this one add pattern to the whole series. I also don't want to have multiple series to set pattern for some of them. How can I achieve my goal?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744147408a4560488.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信