PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of catalin   Easy chart based on Google API chart   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example how to use
Class: Easy chart based on Google API chart
Generate HTML to show Google Charts using its API
Author: By
Last change:
Date: 10 years ago
Size: 2,669 bytes


Class file image Download
<!DOCTYPE html>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src=""></script>
        <title>Testing chart classes</title>
            .celula {
                border: 1px solid black;
function __autoload($class) {
            if (
is_readable($filename)) {
//database connection and fetch data(I have a class databse who give me mysqli)
$select="SELECT oras,ROUND(AVG(spect)) as medie,SUM(spect) as total FROM `meci` WHERE wc=1990 ";
$select.=" GROUP BY oras ORDER BY total DESC";
        if (
$q=$db->query($select)) {
// set the array with columns name
//draw table
$table= new table($columns, $data, 'table_div');
$table->addTableClass('tableCell', 'celula');//add CSS class for table cells
$table->addTableClass('headerCell','celula');//add CSS class for table cells
$table->setOptions('showRowNumber','true');//add a column with order
$table->setOptions('width','500px');//width of table
$table->setOptions('page','enable');//allow pagination
$table->setOptions('pageSize',8);//number of rows on page
echo $table->render();
//draw pie chart
$pie=new pie($columns, $data, 'pie_div');
$pie->setOptions('backgroundColor', "{'strokeWidth':'10'}");
//draw column chart
$columnChart=new column($columns,$data,"column_div");
$geo=new geo($columns,$data,"geo_div");
<div id="table_div"></div>
        <div id="pie_div"></div>
        <div id="column_div"></div>
        <div id="geo_div" style="width:900px;height:500px"></div>