PHP Classes

File: example/public/pareto.php

Recommend this page to a friend!
  Classes of Lucas de Oliveira   FusionCharts PHP Class API   example/public/pareto.php   Download  
File: example/public/pareto.php
Role: Example script
Content type: text/plain
Description: Example script
Class: FusionCharts PHP Class API
Generate graphical charts using FusionCharts API
Author: By
Last change: refactor code and add namespaces
Initial commit
Date: 8 years ago
Size: 675 bytes
 

Contents

Class file image Download
<?php

use FusionCharts\Chart\Pareto;
use
FusionCharts\Tag\Set;

// Data from db
$values = array(
   
'Jan' => 100,
   
'Feb' => 200,
   
'Mar' => 150,
   
'Apr' => 210
);

$chart = new Pareto('chart-container');

$chart
   
->setName('Chart Pareto Example')
    ->
setWidth(800)
    ->
setHeight(400)
    ->
setLabelRotate(true)
    ->
setXdescription('x values')
    ->
setYdescription('y values')
    ->
setAttribute('showyaxisvalues', '0');

$column = new Set();
foreach (
$values as $description => $value) {
   
$column
       
->setAttribute('label', $description)
        ->
setAttribute('value', $value);

   
$chart->addColumn($column);
}

// render chart in the index.php