/** * Raw encode/decode when the subject is json encoded for render */ public function testRawRender() { $testData = array('foo' => Raw::encode('bar')); //expect the property 'bar' to be rendered as raw string and not wrapped //in the JSON standard quotes after being JSON encoded $expected = '{"foo":bar}'; $this->assertEquals($expected, Raw::decode(json_encode($testData))); }
/** * Creates and returns the JavaScript variables and Highcharts instance * @param Chart $chart Instance of Phighchart\Chart * @param Array $options The full set of options for this chart * @return String $ret The JSON string to display the complete chart */ public function outputJavaScript(Chart $chart, array $options) { // use the renderTo id as the JS variable name $jsVar = $this->getRenderTo($chart); return Raw::decode("var " . $jsVar . "; " . $jsVar . " = new Highcharts.Chart(" . json_encode($options) . ");"); }