I've run into some difficulty deleting Datatips on a GUI I'm building using geoaxes and geoplot.
My Scenario: (R2019b)
My GUI has a geoaxes which is plotting multiple lines using a timer function; the geoaxes is updating every 1 second. For the lines being plotted I've set a ButtonDownFcn callback to a function that changes the color of all lines; one color for the selected line, and another color for the rest of the lines. There are more callbacks that this queues as well, but the baseline is I need to update when a specific line is selected.
All of this works correctly, and as it should, but when I click on a line I have a datatip appear, and it follows the clicked line as its data points update. I don't want this to happen, I haven't found any resources that can successfully disable datatips.
Solutions I've found have included disableDefaultInteractivity, delete(findall(gcf, 'type', 'hggroup')), toying with datacursormode; None of them work.
disableDefaultInteractivity doesn't work for two reasons:
1) I get an error trying to use this on my geoaxes handle, the error says the object is not of type axes so it won't work
2) even if I did get this default interactivity to work, I would lose my ability to click and drag around the geoaxes as my lines are plotting. (this is more relevant for R2020a+ because the interactivity of a geoaxes needs to be turned on using enableDefaultInteractivity per R2020a release notes)
delete(findall(gcf, 'type', 'hggroup') works, but doesn't fully do the job:
calling this within the 'buttondownfcn' callback works in deleting previous datatips (originally multiple datatips were being generated), but there seems to be no reference available to the new datatip until after the buttondownfcn callback returns. I can verify this by using the same command in the timer function; the current datatip disappears once the timer function is called.
datacursor and UpdateFcn gives mixed results:
While I'm able to use this to get access to the handle for the current datatip and delete it I get numerous errors because I'm deleting the obj the callback is referencing.
Bottom line:
Is there any way to turn off data tips from the get-go? It seems like this should be controllable on initialization but I can't find anything.
Best Answer