WebSite-PHP Framework PHP
Multi language
Simple Ajax mode
No HTML, no JavaScript
URL rewriting
Mail sending
Sitemap - RSS - Web service
Download WebSite-PHP FrameWork now
 


Loading
 


Tutorial Graphic

Tutorials

>

Tutorial Graphic




To use Graphic, you need to connect to the admin interface of the framework WebSite-PHP.

Once connected you will go to the menu Configuration -> Configure modules and enable the module Graphic.


Tutorial 1 : Simple Chart
File: /pages/tutorials/graphic/graphic-01.php

<?php
class Graphic01 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Simple Chart";
        
        
$this->render = new Chart("chart-01");
        
        
// init data
        
$array_chart_data = array();
        for (
$i=0$i 12$i++) {
            
$array_chart_data[] = array($irand(099));
        }
        
        
// set points of the graphic
        
$this->render->addPoints("Data"
                                
$array_chart_data);
    }
}
?>


Tutorial 2 : Chart with legend
File: /pages/tutorials/graphic/graphic-02.php

<?php
class Graphic02 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Chart with legend";
        
        
$this->render = new Chart("chart-02");
        
        
// init data
        
$array_chart_data = array();
        
$array_chart_data2 = array();
        
$array_chart_data3 = array();
        for (
$i=0$i 12$i++) {
            
$array_chart_data[] = array($irand(099));
            
$array_chart_data2[] = array($irand(099));
            
$array_chart_data3[] = array($irand(099));
        }
        
        
// set points of the graphics
        
$this->render->addPoints("Data 1"
                                
$array_chart_data);
        
$this->render->addPoints("Data 2"
                                
$array_chart_data2);
        
$this->render->addPoints("Data 3"
                                
$array_chart_data3);
                                
        
// display legend
        
$this->render->setLegend();
    }
}
?>


Tutorial 3 : Chart with legend and advance properties
File: /pages/tutorials/graphic/graphic-03.php

<?php
class Graphic03 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Chart with legend 
                            and advance properties"
;
        
        
$this->render = new Chart("chart-03");
        
        
// init data
        
$array_chart_data = array();
        
$array_chart_data2 = array();
        
$array_chart_data3 = array();
        for (
$i=0$i 12$i++) {
            
$date = ($i<10?"0".$i:$i)."/01/".date("Y")." 00:00:00";
            
$array_chart_data[] = array(strtotime($date), rand(099));
            
$array_chart_data2[] = array(strtotime($date), rand(099));
            
$array_chart_data3[] = array(strtotime($date), rand(099));
        }
        
        
// set points of the graphics
        
$this->render->addPoints("Data 1"
                                
$array_chart_data);
        
$this->render->addPoints("Data 2"
                                
$array_chart_data2);
        
$this->render->addPoints("Data 3"
                                
$array_chart_data3);
                                
        
// display legend
        
$this->render->setLegend();
        
        
// define X as date
        
$this->render->setXAxisDataType(Chart::DATA_TYPE_DATE);
        
        
// define Y axis max
        
$this->render->setYAxisMax(150);
        
        
// add mouse tracking
        
$this->render->trackingWithMouse();
    }
}
?>


Tutorial 4 : Chart with bars design
File: /pages/tutorials/graphic/graphic-04.php

<?php
class Graphic04 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Chart with bars design";
        
        
$this->render = new Chart("chart-04");
        
        
// init data
        
$array_chart_data = array();
        
$array_chart_data2 = array();
        
$array_chart_data3 = array();
        for (
$i=0$i 12$i++) {
            
$array_chart_data[] = array($irand(6099));
            
$array_chart_data2[] = array($irand(3059));
            
$array_chart_data3[] = array($irand(1029));
        }
        
        
// set points of the graphics
        
$this->render->addPoints("Data 1"
                                
$array_chart_data,
                                
Chart::DESIGN_BARS);
        
$this->render->addPoints("Data 2"
                                
$array_chart_data2,
                                
Chart::DESIGN_BARS);
        
$this->render->addPoints("Data 3"
                                
$array_chart_data3,
                                
Chart::DESIGN_BARS);
                                
        
// display legend
        
$this->render->setLegend();
    }
}
?>


Tutorial 5 : Chart with other design
File: /pages/tutorials/graphic/graphic-05.php

<?php
class Graphic05 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Chart with other design";
        
        
$this->render = new Chart("chart-05");
        
        
// init data
        
$array_chart_data = array();
        
$array_chart_data2 = array();
        
$array_chart_data3 = array();
        for (
$i=0$i 12$i++) {
            
$array_chart_data[] = array($irand(099));
            
$array_chart_data2[] = array($irand(099));
            
$array_chart_data3[] = array($irand(099));
        }
        
        
// set points of the graphics
        
$this->render->addPoints("Data 1"
                                
$array_chart_data,
                                
Chart::DESIGN_LINES_POINTS_WITH_STEPS);
        
$this->render->addPoints("Data 2"
                                
$array_chart_data2,
                                
Chart::DESIGN_LINES_WITH_STEPS);
        
$this->render->addPoints("Data 3"
                                
$array_chart_data3,
                                
Chart::DESIGN_POINTS);
                                
        
// display legend
        
$this->render->setLegend();
    }
}
?>



Share

 


Copyright © 2009-2017 WebSite-PHP Framework PHP
Home Documentation Download Quick start Tutorials Wiki Issue Tracker