Eliminate the plugin-global redraw flag.
The redraw flag starts out as true, then is immediately set to false on draw. If labels are enabled, drawPie calls drawLabels, which calls drawLabel for each label. Any label that can't fit sets redraw back to true, so the whole process can repeat. This isn't the most obvious mechanism, and forces one to remember to do things like setting redraw back to true after drawing, so the plot can redraw itself on resize or when setting new data. Instead we now have drawPie return true when it drew successfully, and false otherwise, which the same happening in drawLabels and drawLabel. Instead of checking the flag, we now just check the return value. This has the added benefit of slightly improving performance in the case where several redraws are necessary, since it now short-circuits out of the draw loop as soon as one label fails to fit.
Showing
Please
register
or
sign in
to comment