I've currently got several classes that implement a pie chart for the
application I'm working on. The pie chart appears in a subview of a
window and this subview has an NSTrackingArea. The pie chart itself
is drawn using NSBezierPath, where each section of the pie chart is
its own path. As each section is drawn you end up building the pie
chart. Also, as each path is created I add it to a dictionary as a
key and make the associated value a string that will be the tooltip
for that section.
Then, in mouseMoved I iterate over the dictionary keys and if the key
(an NSBezierPath) returns YES for containsPoint I set the toolTip.
The main problem with this implementation appears to be that the
tooltip won't change unless I leave the subview and reenter it. I've
tried removeAllToolTips to fix this problem, but it didn't help.
Does anyone have suggestions on a better implementation? I'd love to
have a tracking area setup for each pie chart section, but this
doesn't seem to be possible since the sections are not rectangular.