How to disable interactions with DonutChart objects?
이전 댓글 표시
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!
채택된 답변
추가 답변 (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
Ralf Ritter
2026년 4월 9일 9:22
dpb
2026년 4월 9일 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
2026년 4월 9일 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...
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

