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

Subscribe to our news:
Partners
Testimonials
Dave Lantz: "I have to say that I simple love this product and its ease of use. I know that I have only tapped into about 20% of what it can do. In my business I come into a lot of contact with developers and I tell them all, that if they need an easy way to connect, report or work their databases they MUST check out your products".
Charles Phillips: "Just want to take a second to really thank you for all the great support you give – I think that’s by far the best feature you offer".

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