Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners
Testimonials
Craig Cordell: "The simplicity of your code generator is fantastic. We've evaluated dozens of others over the past few years but have yet to find one that is as easy to use as yours".
Lucian Nedescu: "Thank you very much. Have a nice century (this is a real wish :P). I think that i will do a great job on my clients database with the new php interface. Thank You again".

More

Add your opinion

PHP Generator for MySQL online Help

Prev Return to chapter overview Next

Advanced options

The previous topic learns how to setup common options of a chart. This topic explains how to customize the chart according to your needs. Live Demo.

 

The key idea is that you can setup absolutely all the options that are available in the Google chart library. All you need is to study the reference from Google and write a few lines of PHP code to set property values.

 

To specify the event, use the Customize button of the Charts tab. The function that is invoked for each chart on the page is defined as follows:

 

Signature:

function OnPrepareChart(Chart $chart)

 

Parameters:

$chart

An instance of the Chart class

getId()

Returns the identifier of the chart (unique among all charts on a page).

setOptions($array)

Sets chart options. Here $array is an associative array that stores all the options you want to apply to the chart.

 

Example 1:

To set the value of the property propName, use the following syntax:

 

$chart->setOptions(array(

       'propName' => 'Value',

 ));

 

To set the value of the property objectName.propName, use the following syntax:

 

$chart->setOptions(array(

       'objectName' =>  array('propName' => 'value'), 

 ));

 

Operating in the same way you can set any property provided by the library.

 

Example 2:

The following code is used in the NBA demo application to customize the chart on the Players page:

 

if ($chart->getId() === 'height-by-avg-age') {

   $chart->setOptions(array(

       'height' => 400,

       'theme' => 'maximized',

       'legend' => array('position' => 'bottom'), 

       'hAxis' => array('format' => '0'),

   ));

}

 

Example 3:

The following code is used in the NBA demo application to customize charts on the Teams->Home games and Teams->Away games pages:

 

$options = array(

    'colors' => array('#9ECC3C', '#CC3C3C'),

    'titleTextStyle' => array('fontSize' => 14),

);

if ($chart->getId() === 'overall-win-loss') {

    $chart->setOptions(array_merge($options, array(

        'chartArea' => array('width' => '70%', 'height' => '70%', 'top' => '18%'),

        'legend' => 'none',

    )));

} else if ($chart->getId() === 'win-loss-by-month') {

    $chart->setOptions(array_merge($options, array(

        'vAxis' => array('format' => '0'),

    )));

}



Prev Return to chapter overview Next