示例#1
0
 public function testSvgLinkingWithoutRendering()
 {
     $filename = $this->tempDir . __FUNCTION__ . '.svg';
     $chart = new ezcGraphLineChart();
     $chart->data['Line 1'] = new ezcGraphArrayDataSet(array('sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1));
     try {
         ezcGraphTools::linkSvgElements($chart);
     } catch (ezcGraphToolsNotRenderedException $e) {
         return true;
     }
     $this->fail('Expected ezcGraphToolsNotRenderedException.');
 }
<?php

require_once 'tutorial_autoload.php';
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteEzGreen();
$graph->title = 'Access statistics';
$graph->driver = new ezcGraphGdDriver();
$graph->options->font = 'tutorial_font.ttf';
$graph->data['Access statistics'] = new ezcGraphArrayDataSet(array('Mozilla' => 19113, 'Explorer' => 10917, 'Opera' => 1464, 'Safari' => 652, 'Konqueror' => 474));
$graph->data['Access statistics']->url = 'http://example.org/';
$graph->data['Access statistics']->url['Mozilla'] = 'http://example.org/mozilla';
$graph->render(400, 200, 'tutorial_reference_gd.png');
?>
<html>
    <head><title>Image map example</title></head>
<body>
<?php 
echo ezcGraphTools::createImageMap($graph, 'GraphPieChartMap');
?>
    <img
        src="tutorial_reference_gd.png"
        width="400" height="200"
        usemap="#GraphPieChartMap" />
</body>
</html>
<?php

require_once 'tutorial_autoload.php';
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteEz();
$graph->title = 'Access statistics';
$graph->data['Access statistics'] = new ezcGraphArrayDataSet(array('Mozilla' => 19113, 'Explorer' => 10917, 'Opera' => 1464, 'Safari' => 652, 'Konqueror' => 474));
$graph->data['Access statistics']->url = 'http://example.org/';
$graph->data['Access statistics']->url['Mozilla'] = 'http://example.org/mozilla';
$graph->render(400, 200, 'tutorial_reference_svg.svg');
$graph->driver->options->linkCursor = 'crosshair';
ezcGraphTools::linkSvgElements($graph);