How to disable interactions with DonutChart objects?
Show older comments
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!
Accepted Answer
More Answers (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 Comments
Ralf Ritter
on 9 Apr 2026 at 9:22
dpb
on 9 Apr 2026 at 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
on 9 Apr 2026 at 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...
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
