1
のカスタムマーカーをクリックしたときに、火災のJavascript機能私は(ちょうどこの例のように:https://www.amcharts.com/demos/custom-html-elements-map-markers/)カスタムHTMLマーカーを持つAmChartの世界地図を利用しようとしているAmCharts
私が持っているコードは以下であり、私は何を追加しました私は、AmChart Webサイトの別の例に基づいて、有効なクリックリスナーになることを期待していました。
var map;
map = AmCharts.makeChart("chartdiv", {
"type": "map",
"theme": "black",
"projection": "miller",
"imagesSettings": {
"rollOverColor": "#42adca",
"rollOverScale": 3,
"selectedScale": 3,
"selectedColor": "#42adca",
"color": "#42adca"
},
"areasSettings": {
"unlistedAreasColor": "#42adca"
},
"dataProvider": {
"map": "worldLow",
"images": [ {
"zoomLevel": 5,
"scale": 0.5,
"title": "San Jose, CA",
"latitude": 37.3382,
"longitude": -121.8863,
"click": 'test()'
}, {
"zoomLevel": 5,
"scale": 0.5,
"title": "Dulles, VA",
"latitude": 38.9559,
"longitude": -77.4478
}, {
"zoomLevel": 5,
"scale": 0.5,
"title": "London, UK",
"latitude": 51.5074,
"longitude": 0.1278
}, {
"zoomLevel": 5,
"scale": 0.5,
"title": "Denver, CO",
"latitude": 39.7392,
"longitude": -104.9903
}, {
"zoomLevel": 5,
"scale": 0.5,
"title": "Miami, FL",
"latitude": 25.7617,
"longitude": -80.1918
}, {
"zoomLevel": 5,
"scale": 0.5,
"title": "Los Angeles, CA",
"latitude": 34.0522,
"longitude": -118.2437
}, {
"zoomLevel": 5,
"scale": 0.5,
"title": "New York, NY",
"latitude": 40.7128,
"longitude": -74.0059
}, {
"zoomLevel": 5,
"scale": 0.5,
"title": "Chicago, IL",
"latitude": 41.8781,
"longitude": -87.6298
} ]
},
"listeners": [{
"event": "clickMapObject",
"method": function(event) {
console.log(event.mapObject.title);
}
}]
});
ただし、console.logは起動しません。地図をクリックしても何もしません。 URLは設定できますが、JS関数を指定したいと思います。
すべてのポインタが優れています。