我正在使用 amcharts4,我想在点击事件时动态更改工具提示值;我试过这个:
let chart = am4core.create("chartdiv", am4maps.MapChart);
chart.projection = new am4maps.projections.Miller();
let worldSeries = chart.series.push(new am4maps.MapPolygonSeries());
... some code
let worldPolygon = worldSeries.mapPolygons.template;
worldPolygon.tooltipText = '{name}';
worldPolygon.events.on("hit", async function(ev) {
let destination_actif = await context.$get_destination_actif_by_country_code(code) // api request on hit a country polygon
// condition to check if there is result
if(!destination_actif.data){
worldPolygon.tooltipText = 'No result';
}else{
worldPolygon.tooltipText = 'With result';
}
}
在点击请求 api 之后,我想根据结果条件更改工具提示值,但是在这里,当我console.log
工具提示时,值发生了变化,但是在将多边形悬停时,值仍然相同"{name}"