-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Click event on ammap firing twice everytime #51
Comments
Click event should not be fired twice. It should not be fired on map drag, either. Here's your map in a standalone setting: I works as expected. Could you double check if you are running the latest version? (3.21.4) I remember having us fixed click event in some version. |
@rbasniak Also make sure that you're using this.chart = this.AmCharts.makeChart("chartdiv", {
"type": "map",
"theme": "light",
"dataProvider": {
"map": "worldLow",
"getAreasFromMap": true
},
"areasSettings": {
"autoZoom": false,
"selectedColor": "#CC0000"
}
});
this.AmCharts.updateChart(this.chart, () => {
this.chart.addListener("click", event => {
// find out the coordinates of under mouse cursor
var info = event.chart.getDevInfo();
// print in console as well
console.log({
"latitude": info.latitude,
"longitude": info.longitude
});
});
}); |
@Pauan @martynasma I found the problem. The
If I do, the click event is fired twice and on map pan. If I remove these scripts, it all works as expected. I'm closing the issue because the problem is fixed, but I would like to understand why if someone can explain to me... Is it ok to remove the script tags, or there's a problem on the readme.md? |
@rbasniak You're right, that seems to be a bug in AmCharts v3. The README assumes that you are using the You have to change the It should be completely fine for you to remove the <script src="https://www.amcharts.com/lib/3/ammap.js"></script>
<script src="https://www.amcharts.com/lib/3/maps/js/worldLow.js"></script>
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script> |
Hi, I'm trying to use the ammap and this is my setup (on OnInit method):
`
It's working, I can see the map and the click event is registered, but:
it fires when I pan the map, is this the expected behavior?
it's fired twice every time I click the map.
The text was updated successfully, but these errors were encountered: