try this, it worked for me. This will draw a circle on the canvas id.
public function testDraw() { try { $this->execute(array('script' => " var c = document.getElementById('canvas'); var ctx = c.getContext('2d'); ctx.beginPath(); ctx.arc(100, 75, 50, 0, 2 * Math.PI); ctx.stroke();", 'args' => array())); echo 'done'; sleep(10); } catch (Exception $ex) { echo 'not done'; }
source share