How to disable interactions with DonutChart objects?
Afficher commentaires plus anciens
Hi everyone,
I’m using the donutchart function (which returns a DonutChart object) and I’m looking for a supported way to disable chart interactions—specifically:
- Data tips
- The export interaction
For conventional plots (for example, line plots, scatter plots), I can usually disable interactions at the axes level. However, for donut charts I haven’t found an approach that reliably disables these interactions on the DonutChart object itself.
If anyone has a method (or knows whether this is currently not configurable for DonutChart), I’d really appreciate guidance.
Thanks a lot!
Réponse acceptée
Plus de réponses (1)
The penchant for creating all these specialty objects that are opaque so can't get to underlying axes for customizations that Mathworks' developers didn't think about is infuriating...
Rant aside, it turns out the underlying objects are in a tiled layout and one may be able to go handle-diving therein and figure out something.
data = [1 2 3 4];
hD=donutchart(data); % return handle to the chart object
hTL=hD.NodeChildren; % hidden property returns a tiled layout
hPAx=hTL.Children; % and its progeny -- a polar axes object
hPAx.Type % see who/what we gots
hPAx.Tag % doesn't have an identifier...
hPAx is the handle to a polar axis object; you can see if you can figure out how to make it behave as wish. One can easily go down the rabbit hole with Alice, however...
Such is reliant upon <Yair Altman's getundoc FEX submission> to find the hidden properties' names...
Of course, such is always undocumented and can change at a moment's whim...
ADDENDUM
I don't think it would be out of line to submit this to Mathworks as an enhancement request at <Product Support Page> describing needs and use throughly for the desired functionality. Might just get a workaround that inside knowledge provides.
4 commentaires
Ralf Ritter
le 9 Avr 2026 à 9:22
dpb
le 9 Avr 2026 à 14:02
data = [1 2 3 4];
hD=donutchart(data);
hDStruct = struct(hD); % Reveal hidden properties
hDStruct.Datatip.Visible = "off";
But the above just sets the value in the local struct, not in the object...
Try
hD.Datatip.Visible = "off";
dpb
le 9 Avr 2026 à 14:58
Not sure what is up with that, but looks as though are hosed.
getendoc(hD)
returns the p;roperty name but returns "???" rather than a value which I've learned with time is a bad sign that things are going south...
Catégories
En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

