我正在使用amCharts地图作为反应组件。根据我的数据,我有标记和相关的工具提示。数据更新时,我会向地图提供新数据。但是,由于我的工具提示始终显示为true,因此地图会创建工具提示的新实例,而不是更新工具提示文本。
如果我禁用了alwaysShowTooltip,而是将鼠标悬停在标记上以弹出工具提示,那么我看到的更新数据没有问题。
let imageSeriesTemplate = mapImageSeries.mapImages.template;
let marker = imageSeriesTemplate.createChild(am4core.Image);
marker.alwaysShowTooltip = true;
marker.tooltipText ='[bold]{numTransactions}[/] txns received \n\n\n {name}';
this.map = map;
this.series = mapImageSeries;
...
//on new data received
this.series.data = newData;
粘性工具提示应无缝更新,而不创建新实例。