Added in a fix that allows piecharts to be drawn first (may have to come back to it, sets flag to true if a piechart object already exists).