public function draw($div, array $options = [])
        {
            $output = '';

            if (self::$_first) {
                $output .= $this->initChart();
            }

            // start a code block
            $output .= '<script type="text/javascript">' . "\n";

            // set callback function
            $output .= 'google.setOnLoadCallback(drawChart' . self::$_count . ');' . "\n";

            // create callback function
            $output .= 'function drawChart' . self::$_count . '() {' . "\n";

            $output .= 'var data = new google.visualization.DataTable(' . $this->_data . ');' . "\n";

            // set the options
            $output .= 'var options = ' . json_encode($options) . ';' . "\n";

            // create and draw the chart
            $output .= 'var chart = new google.visualization.' . $this->_chartType . '(document.getElementById(\'' . $div . '\'));' . "\n";
            $output .= 'chart.draw(data, options);' . "\n";

            $output .= '} </script>' . "\n";

            return $output;
        }
public function draw($div, array $options = [])
        {
            $output = '';

            if (self::$_first) {
                $output .= $this->initChart();
            }

            // start a code block
            $output .= '<script type="text/javascript">' . "\n";

            // set callback function
            $output .= 'google.setOnLoadCallback(drawChart' . self::$_count . ');' . "\n";

            // create callback function
            $output .= 'function drawChart' . self::$_count . '() {' . "\n";

            $output .= 'var data = new google.visualization.DataTable(' . $this->_data . ');' . "\n";

            // set the options
            $output .= 'var options = ' . json_encode($options) . ';' . "\n";

            // create and draw the chart
            $output .= 'var chart = new google.visualization.' . $this->_chartType . '(document.getElementById(\'' . $div . '\'));' . "\n";
            $output .= 'chart.draw(data, options);' . "\n";

            $output .= '} </script>' . "\n";

            return $output;
        }
public function draw ( $ div , array $ options = [ ] ) { $ output = '' ; if ( self :: $ _first ) { $ output .= $ this -> initChart ( ) ; } // start a code block $ output .= '<script type="text/javascript">' . "\n" ; // set callback function $ output .= 'google.setOnLoadCallback(drawChart' . self :: $ _count . ');' . "\n" ; // create callback function $ output .= 'function drawChart' . self :: $ _count . '() {' . "\n" ; $ output .= 'var data = new google.visualization.DataTable(' . $ this -> _data . ');' . "\n" ; // set the options $ output .= 'var options = ' . json_encode ( $ options ) . ';' . "\n" ; // create and draw the chart $ output .= 'var chart = new google.visualization.' . $ this -> _chartType . '(document.getElementById(\'' . $ div . '\'));' . "\n" ; $ output .= 'chart.draw(data, options);' . "\n" ; $ output .= '} </script>' . "\n" ; return $ output ; }
draws the chart
draws the chart