How to include an image title and a watermark but only into the exported image using .export()?
This example shows a function with .export()
https://codepen.io/team/amcharts/pen/ergXmr?editors=1111
// Create chart instance
var chart = am4core.create("chartdiv", am4charts.XYChart);
// Add data
chart.data = [{
"category": "Research & Development",
"value": 3.5
}, {
"category": "Marketing",
"value": 6
}, {
"category": "Distribution",
"value": 4.2
}];
// Create axes
let categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "category";
let valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
// Create series
var series = chart.series.push(new am4charts.ColumnSeries());
series.dataFields.valueY = "value";
series.dataFields.categoryX = "category";
series.name
// Custom export function
function exportPNG() {
chart.exporting.title = "myTitle"; /* not working */
chart.exporting.export("png");
}
var options = chart.exporting.getFormatOptions("png");
options.keepTainted = true;
chart.exporting.setFormatOptions("png", options);
I also need a watermark (only in the exported image):
var watermark = chartPie.createChild(am4core.Label);
watermark.text = "Source: [bold]www.domain.com[/]";
watermark.align = "right";
watermark.fillOpacity = 0.5;
watermark.marginRight = 10;
watermark.marginBottom = 10;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…