添加背景图像到XYChart


let chart = am4core.create("chartdiv", am4charts.XYChart);
chart.background.image = am4core.image("/static/img/bar-chart.png")

在Amchart中,我试图在我的图表上添加背景图像。但是当我这样做的时候,它不工作。

请看看有没有办法

我修改了水印教程

// Add watermark
var watermark = new am4core.Image();
watermark.href = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-160/cat.svg";
chart.plotContainer.children.push(watermark);
watermark.align = "right";
watermark.valign = "bottom";
watermark.opacity = 0.3;
watermark.marginRight = 10;
watermark.marginBottom = 5;

:

// Add watermark
var watermark = new am4core.Image();
watermark.href = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-160/cat.svg";
chart.plotContainer.children.push(watermark);
watermark.align = "center";
watermark.valign = "bottom";
watermark.opacity = 0.3;
watermark.height = 200;
watermark.width = 200;

根据你的需要,你可能需要修改不透明度,高度和宽度。

相关内容

  • 没有找到相关文章