Пример #1
0
 /**
  * @param Set $set
  * @return Pie
  */
 public function addSlice(Set $set)
 {
     $this->slices[] = $set->getXML();
     return $this;
 }
Пример #2
0
<?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
Пример #3
0
<?php

use FusionCharts\Chart\Pie;
use FusionCharts\Tag\Set;
// Data from db
$values = array('Jan' => 100, 'Feb' => 200, 'Mar' => 150, 'Apr' => 210);
$chart = new Pie('chart-container');
$chart->setName('Chart Pie Example')->setWidth(800)->setHeight(400)->setAttribute('showlegend', '1')->setAttribute('showlabels', '0');
$slice = new Set();
foreach ($values as $name => $value) {
    $slice->setAttribute('issliced', '1')->setAttribute('label', $name)->setAttribute('value', $value);
    $chart->addSlice($slice);
}
// render chart in the index.php
Пример #4
0
<?php

use FusionCharts\Chart\Plot;
use FusionCharts\Tag\Categories;
use FusionCharts\Tag\Category;
use FusionCharts\Tag\DataSet;
use FusionCharts\Tag\Set;
// Data from db
$months = array('Jan', 'Feb', 'Mar', 'Apr');
$xValues = array(100, 200, 300, 400);
$yValues = array(150, 120, 200, 220);
$chart = new Plot('chart-container');
$categories = new Categories();
foreach ($months as $index => $month) {
    $category = new Category();
    $category->setAttribute('label', $month)->setAttribute('x', $xValues[$index])->setAttribute('showVerticalLine', '1');
    $categories->addCategory($category);
}
$plots = new DataSet();
$plots->setAttribute('color', '000080')->setAttribute('anchorbgcolor', '000080')->setAttribute('anchorradius', '4')->setAttribute('anchorsides', '4');
foreach ($yValues as $index => $value) {
    $plot = new Set();
    $plot->setAttribute('y', $value)->setAttribute('x', $xValues[$index]);
    $plots->addSet($plot);
}
$chart->setName('Chart Plot Example')->setWidth(800)->setHeight(400)->setLabelRotate(true)->setXdescription('x values')->setYdescription('y values')->setAttribute('showyaxisvalues', '0')->addCategories($categories)->addPlots($plots);
// render chart in the index.php
Пример #5
0
 /**
  * @param Set $set
  * @return Pareto
  */
 public function addColumn(Set $set)
 {
     $this->sets[] = $set->getXML();
     return $this;
 }