function barchart(){
return $canvas;
}
OR (If you want to save this layer image to disk):
function barchart(){
$path = {path where to save file};
$filename = {filename to save and extension};
imagepng($canvas,$path.$filename);
return $path.$filename;
}
Do this same for the other(drawing) class too..