Minor refactoring of ChartCanvas.