Just use a static array of labels instead of generating it each time for every graph.