sync legend color with the graph

When setting the colors of the graph/pie, the legend doesn't match automatically. This PR fixes this.