Beispiel 22 - Shapes

Quellcode zum Beispiel

<?php

// siehe http://www.goat1000.com/svggraph-bar3d.php

require '../../svggraph/autoloader.php';

$settings = array(
  'auto_fit' => true,
  'back_colour' => 'none',
  'data_label_font' => 'Courier',
  'data_label_font_adjust' => 0.6,
  'data_label_type' => 'box',
  'data_label_space' => 10,
  'data_label_padding' => 6,
  'data_label_tail_length' => 'auto',
  'data_label_tail_end' => 'filled',
  'data_label_tail_end_width' => 18,
  'data_label_tail_end_angle' => 30,
  'label' => array(
    array(
      280, 180,
      "Ein Label zeigt\nauf ein anderes",
      'type' => 'linebox',
      'fill' => '#cef',
      'position' => '200 50',
      'round' => 10,
      'padding' => 2,
      'tail_end_width' => 20,
    ),
  ),
);

$settings['shape'] = array(
array(
  // type of shape
  'circle',

  // shape attributes
  'cx' => 'g1',
  'cy' => 'g3',
  'r' => 'u1x',

  // styling
  'fill' => array('#f00', 'pattern' => 'polkadot'),
  'depth' => 'above',
  'href' => '/',

  // SVG attributes
  'fill-opacity' => 0.75,
  'stroke-width' => 2
  ),
array(
  // type of shape
  'ellipse',

  // shape attributes
  'cx' => 'g2',
  'cy' => 'g3',
  'rx' => '15',
  'ry' => '10',

  // styling
  'fill' => array('#00f', 'pattern' => 'polkadot'),
  'depth' => 'above',
  'href' => '/',

  // SVG attributes
  'fill-opacity' => 0.75,
  'stroke-width' => 2
  ),  
);

$settings['legend_entries'] = array(
  '2012'
);

$settings['graph_title'] = "Grafik mit individuellen Labels. Diese können auf Basis der \nKoordinaten oder der Grafikabmessungen positioniert werden";
$settings['graph_title_font_size'] = '15';
$settings['label_x'] = 'Mitarbeiter';
$settings['label_y'] = 'Anzahl Urlaubstage';

$values = array(
 array('Dough' => 30, 'Ray' => 20, 'Me' => 20, 'Sonnyboy' => 25, 'Far' => 25, 'Lard' => 12),
);

$colours = array(array('green','yellow'));

$graph = new Goat1000\SVGGraph\SVGGraph(600, 400, $settings);

// $graph->colours = $colours;
$graph->colours($colours);
$graph->Values($values);
$graph->Render('GroupedBar3DGraph');

?>