WebSite-PHP Framework PHP
Multi langues
Mode Ajax simple
Aucun HTML, aucun JavaScript
URL rewrinting
Envoi d'email
Sitemap - RSS - Web service
Télécharger le Framework WebSite-PHP maintenant
 


Loading
 


Tutoriel Graphic

Tutoriels

>

Tutoriel Graphic




Pour utiliser Graphic vous devez vous connecter à l'interface administrateur du framework WebSite-PHP.

Une fois connecté vous devrez aller dans le menu configuration -> Configurer modules et activer le module Graphic.


Tutoriel 1 : Simple Chart
Fichier: /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);
    }
}
?>


Tutoriel 2 : Chart with legend
Fichier: /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();
    }
}
?>


Tutoriel 3 : Chart with legend and advance properties
Fichier: /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();
    }
}
?>


Tutoriel 4 : Chart with bars design
Fichier: /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();
    }
}
?>


Tutoriel 5 : Chart with other design
Fichier: /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-2024 WebSite-PHP Framework PHP
Accueil Documentation Télécharger Quick start Tutoriels Wiki Issue Tracker