I am trying to set up AmCharts 4 charts witha checkbox legend.
I have set a background image to every legend, but can't find a way to toggle that image when turning on and off the legend item.
// add legend
this.chart.legend = new am4charts.Legend();
this.chart.legend.useDefaultMarker = true;
// Remove square from marker template
const marker = this.chart.legend.markers.template;
marker.disposeChildren();
// Add custom image instead
const checkbox = marker.createChild(am4core.Image);
checkbox.width = 40;
checkbox.height = 40;
checkbox.verticalCenter = "top";
checkbox.horizontalCenter = "left";
checkbox.adapter.add("href", (href: any, target: any) => {
if(!target.dataItem.dataContext.isHidden) {
return "http://cdn.onlinewebfonts.com/svg/img_207414.png";
}
else {
return '';
}
});

