In jpgraph.php near line 162 you may try adding the code shown below. None of the image types were defined so using another image type would throw an error too. Not 100% sure this will solve the issue but it should.
define('IMG_JPG',false);
define('IMG_GIF',false);
define('IMG_PNG',false);
define('IMG_WBMP',false);
define('IMG_XPM',false);