I want to use scattermapbox to show pin point on top of another layer of choropleth mapbox. It works well on default symbol style, which is circle in this case.
However, I want to change the symbol of the marker and the marker won’t show up after i change the symbol of the marker. Has anyone runs into similar issue as mine?
Regarding to the image above, I was thinking to do a blinking effect instead of locating a pin point on the desired location/country, something looks like this:
I tried to look around Plotly js function but there doesn’t seem a way for me to achieve that.
Is it possible to achieve that with mapbox object?
I see… I am using Python Dash here… Is there a way for me to trigger the animation without using a button, after creating all the frames?
Currently I am trying to trigger the blinking animation, chained after a callback (i.e. searching on particular country on the map). How can I animate the figure after the figure object is returned?
As @RenaudLN suggesting here, I am trying to animating the opacity on the selected country on my choroplethmapbox trace to create a blinking effect. (not through a click/hover event, is a chained action after choosing a value from a dropdown)
I did try clientside callback, but I didn’t quite sure how the graph created in Python can be used in clientside callback. This is what i did in my clientside callback:
if (!window.dash_clientside) {
window.dash_clientside = {};
}
window.dash_clientside.clientside = {
onMapSearch: function(countryName) {
var mapObj = document.getElementById('my-map-id');
var data = mapObj.children[1].data[0]
var layout = mapObj.children[1].layout
var frames = []
var opacities = []
var locList = data.locations
// setting up the array of marker opacities here
// 0 for the selected country, else 1
for (let n in locList) {
if (locList[n] === countryName) {
opacities.push(0)
console.log(countryName)
}
else opacities.push(1)
}
// setting up frames with different opacity
for (i = 0; i < 6; i++) {
if (i % 2 == 0) {
data.marker.opacity = 1
} else {
data.marker.opacity = opacities
}
frames.push(data)
}
Plotly.newPlot('my-map-id', data, layout)
Plotly.animate('my-map-id', frames, {transition: {duration: 0},frame:{duration:0}});
}
}
When I try the callback in my Dash app, the graph becomes empty after the callback triggered. Also, the animation is not running. What is the way to get the things work correctly here?