ammap气球点击事件

ammap balloon click event

有没有在 AmMap 上跟踪气球点击的方法?

这个似乎可以跟踪地图上任何地方的点击。

map.addListener("click", handleMapClick);

虽然这没有任何效果。

map.addListener("clickMapObject", handleMapObjectClick);

-

function handleMapClick(event) {
    console.log(event);
}

function handleMapObjectClick(event) {
    console.log(event);
}

http://jsfiddle.net/vfnw9mxx/

在您的 JSFiddle 中,尝试更改:

    dataProvider.images.push({
        type: "circle",
        width: size,
        height: size,
        // color: dataItem.color,
        longitude: heatmapData[i].lon,
        latitude: heatmapData[i].lat,
        title: heatmapData[i].country,
        value: heatmapData[i].count
    });

至:

    dataProvider.images.push({
        type: "circle",
        width: size,
        height: size,
        // color: dataItem.color,
        longitude: heatmapData[i].lon,
        latitude: heatmapData[i].lat,
        title: heatmapData[i].country,
        value: heatmapData[i].count,
        selectable: true
    });

(请参阅最后一行,添加可选择项)。

这似乎是一个未记录的要求。它由此处的 amcharts 演示提供:http://jsfiddle.net/amcharts/6WVvS/ linked to/"documented" at: http://www.amcharts.com/tutorials/interacting-between-javascript-charts-and-javascript-maps/