summaryrefslogtreecommitdiffstats
path: root/docs/examples/wikipedia.php
blob: 3e3f0b53aeb6bc152bcc2d4e52b5ad8799ac7984 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

require 'Base/src/base.php';
function __autoload( $className )
{
        ezcBase::autoload( $className );
}

// Create the graph
$graph = new ezcGraphPieChart();

// Add the data and hilight norwegian data set
$graph->data['articles'] = new ezcGraphArrayDataSet( array(
    'English' => 1300000,
    'Germany' => 452000,
    'Netherlands' => 217000,
    'Norway' => 70000,
) );
$graph->data['articles']->highlight['Norway'] = true;

// Set graph title
$graph->title = 'Articles by country';

// Modify pie chart label to only show amount and percent
$graph->options->label = '%2$d (%3$.1f%%)';

// Use 3d renderer, and beautify it
$graph->renderer = new ezcGraphRenderer3d();
$graph->renderer->options->pieChartShadowSize = 12;
$graph->renderer->options->pieChartGleam = .5;
$graph->renderer->options->dataBorder = false;
$graph->renderer->options->pieChartHeight = 16;
$graph->renderer->options->legendSymbolGleam = .5;
$graph->renderer->options->pieChartOffset = 100;

// Output the graph with std SVG driver
$graph->render( 500, 200, 'wiki_graph.svg' );

OpenPOWER on IntegriCloud