public function testCreateDatasetFromDatasetHighOrderConstructorParameter()
 {
     $arrayDataSet = new ezcGraphArrayDataSet(array(-1 => 2, 1 => 2, 3 => 10));
     $averageDataSet = new ezcGraphDataSetAveragePolynom($arrayDataSet, 3);
     $polynom = $averageDataSet->getPolynom();
     $this->assertEquals('x^2 + 1', $polynom->__toString());
 }
Exemple #2
0
<?php

require_once '../tutorial_autoload.php';
$graph = new ezcGraphBarChart();
$graph->title = 'Random data with average line.';
$graph->legend->position = ezcGraph::BOTTOM;
$graph->palette = new ezcGraphPaletteEzBlue();
$graph->xAxis = new ezcGraphChartElementNumericAxis();
$graph->xAxis->axisLabelRenderer = new ezcGraphAxisBoxedLabelRenderer();
$graph->xAxis->majorStep = 1;
$data = array();
for ($i = 0; $i <= 10; $i++) {
    $data[$i] = mt_rand(-5, 5);
}
// Add data
$graph->data['random data'] = $dataset = new ezcGraphArrayDataSet($data);
$average = new ezcGraphDataSetAveragePolynom($dataset, 3);
$graph->data[(string) $average->getPolynom()] = $average;
$graph->data[(string) $average->getPolynom()]->displayType = ezcGraph::LINE;
$graph->data[(string) $average->getPolynom()]->symbol = ezcGraph::NO_SYMBOL;
$graph->options->fillLines = 150;
$graph->render(400, 150, 'example_03.svg');
<?php

require_once 'tutorial_autoload.php';
$wikidata = (include 'tutorial_wikipedia_data.php');
$graph = new ezcGraphRadarChart();
$graph->palette = new ezcGraphPaletteEzBlue();
$graph->options->fillLines = 220;
$graph->legend->position = ezcGraph::BOTTOM;
$graph->rotationAxis = new ezcGraphChartElementNumericAxis();
$graph->rotationAxis->majorStep = 2;
$graph->rotationAxis->minorStep = 0.5;
mt_srand(5);
$data = array();
for ($i = 0; $i <= 10; $i++) {
    $data[$i] = mt_rand(-5, 5);
}
$data[$i - 1] = reset($data);
$graph->data['random data'] = $dataset = new ezcGraphArrayDataSet($data);
$average = new ezcGraphDataSetAveragePolynom($dataset, 4);
$graph->data[(string) $average->getPolynom()] = $average;
$graph->data[(string) $average->getPolynom()]->symbol = ezcGraph::NO_SYMBOL;
$graph->data[(string) $average->getPolynom()]->color = '#9CAE86';
$graph->render(500, 250, 'tutorial_complex_radar_chart.svg');
<?php

require_once 'tutorial_autoload.php';
$graph = new ezcGraphLineChart();
$graph->title = 'Some random data';
$graph->legend->position = ezcGraph::BOTTOM;
$graph->options->fillLines = 210;
$graph->xAxis = new ezcGraphChartElementNumericAxis();
$data = array();
for ($i = 0; $i <= 10; $i++) {
    $data[$i] = mt_rand(-5, 5);
}
// Add data
$graph->data['random data'] = $dataset = new ezcGraphArrayDataSet($data);
$average = new ezcGraphDataSetAveragePolynom($dataset, 3);
$graph->data[(string) $average->getPolynom()] = $average;
$graph->renderer = new ezcGraphRenderer3d();
$graph->render(400, 150, 'tutorial_line_chart_3d.svg');