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 : Chart with legend 
and advance properties

Tutorials

>

Tutorial Graphic

>

Tutorial : Chart with legend and advance properties


Graphic-03: Tutorial of the composant Graphic of the PHP FrameWork WebSite-PHP.

Tutorial : Chart with legend and advance properties:



Go back to tutorial of the componant Graphic



Source code

Source code



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.



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();
    }
}
?>


Go back to tutorial of the componant Graphic


Share

 


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