Я пытаюсь настроить диаграммы AmCharts 4 с легендой флажка.
Я установил фоновое изображение для каждой легенды, но не могу найти способ переключать это изображение при включении и выключении элемента легенды.
// 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 '';
}
});