- 1. Beispiel 1
- 1.1. Quellcode Beispiel 1
- 2. Beispiel 2
- 2.1. Quellcode Beispiel 2
- 3. Beispiel 3
- 3.1. Quellcode Beispiel 3
Beispiel 1
Quellcode Beispiel 1
<?php
// siehe http://www.goat1000.com/svggraph-bar3d.php
require '../../svggraph/autoloader.php';
$settings = array(
'stroke_colour' => '#000',
'back_stroke_width' => 0,
'back_stroke_colour' => '#eee',
'axis_colour' => '#333',
'axis_overlap' => 2,
'axis_font' => 'Georgia',
'axis_font_size' => 10,
'grid_colour' => '#666',
'label_colour' => '#000',
'pad_right' => 20,
'pad_left' => 20,
'link_base' => '/',
'link_target' => '_top',
'project_angle' => 45,
'minimum_grid_spacing' => 20,
'legend_title' => 'Legende',
'legend_back_colour' => 'none',
'legend_position' => 'outer top',
'show_labels' => true,
'show_data_labels' => true,
'data_label_type' => array('plain', 'box', 'bubble', 'line'),
'data_label_space' => 5,
'data_label_back_colour' => array('#ccc', null, null, '#ccc'),
'data_label_padding' => 5,
'data_label_round' => 4,
'data_label_tail_length' => 5,
'data_label_tail_width' => 5,
'data_label_font_size' => 12,
'data_label_fill' => array(
array('#ccc','#fff','#ccc','h'),
),
'data_label_outline_thickness' => 2,
'data_label_position' => 'above'
);
$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(
'g4', 'g10',
'Label above'
),
array(
'g4', 'g10',
'Label to right',
'position' => 'right'
),
array(
'g4', 'g10',
'Label to left',
'position' => 'left'
),
array(
'g4', 'g10',
'Label below',
'position' => 'bottom'
),
// yellow label
array(
200, 100,
"Auf Grafikposition (200,100)",
'type' => 'bubble',
'fill' => array('#ff6','#ffc','#ff6','h'),
'round' => 10
),
// blue label
array(
280, 80,
"Ein Label zeigt\nauf ein anderes",
'type' => 'linebox',
'fill' => '#cef',
'position' => '200 50',
'round' => 10,
'padding' => 10,
'tail_end_width' => 20,
),
// crossing white labels
array(
100, 370,
'Labels',
'type' => 'linebox',
'position' => '100 -100'
),
array(
100, 350,
'werden',
'type' => 'linebox',
'position' => '100 -60'
),
array(
100, 330,
'in der',
'type' => 'linebox',
'position' => '100 -20'
),
array(
100, 310,
'Reihenfolge',
'type' => 'linebox',
'position' => '100 20'
),
array(
100, 290,
'des Arrays',
'type' => 'linebox',
'position' => '100 60'
),
array(
100, 270,
'gezeichnet',
'type' => 'linebox',
'position' => '100 100'
),
),
);
$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');
?>
Beispiel 2
Quellcode Beispiel 2
<?php
// siehe http://www.goat1000.com/svggraph-bar3d.php
require '../../svggraph/autoloader.php';
$settings = array(
'axis_colour' => '#333',
'axis_overlap' => 2,
'axis_font' => 'Georgia',
'axis_font_size' => 10,
'back_colour' => 'none',
'back_stroke_width' => 0,
'back_stroke_colour' => '#eee',
'data_label_type' => array('plain', 'box', 'bubble', 'line'),
'data_label_space' => 5,
'data_label_back_colour' => array('#ccc', null, null, '#ccc'),
'data_label_padding' => 5,
'data_label_round' => 4,
'data_label_tail_length' => 5,
'data_label_tail_width' => 5,
'data_label_font_size' => 12,
'data_label_fill' => array(
array('#ccc','#fff','#ccc','h'),
),
'data_label_outline_thickness' => 2,
'data_label_position' => 'above',
'grid_colour' => '#666',
'label_colour' => '#000',
'legend_title' => 'Legende',
'legend_back_colour' => 'none',
'legend_position' => 'outer top',
'link_base' => '/',
'link_target' => '_top',
'minimum_grid_spacing' => 20,
'pad_right' => 20,
'pad_left' => 20,
'project_angle' => 45,
'show_data_labels' => true,
'stroke_colour' => '#000',
);
$settings = array(
'auto_fit' => true,
'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(
200, 100,
"Auf Grafikposition (200,100)",
'type' => 'bubble',
'fill' => array('#ff6','#ffc','#ff6','h'),
'round' => 10
),
// blue label
array(
280, 80,
"Ein Label zeigt\nauf ein anderes",
'type' => 'linebox',
'fill' => '#cef',
'position' => '200 50',
'round' => 10,
'padding' => 10,
'tail_end_width' => 20,
),
),
);
$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');
?>
Beispiel 3
Quellcode Beispiel 3
<?php
// Custom labels, siehe https://www.goat1000.com/svggraph-source/custom-labels
require '../../svggraph/autoloader.php';
$settings = [
'auto_fit' => true,
'marker_size' => 0,
'stroke_colour' => '#00f',
'show_tooltips' => false,
'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' => [
[375, 55, "Vorläufige\nDaten", 'type' => 'linebox','angle' => 315,
'fill' => '#cef', 'position' => '-30 -30', 'round' => 5, 'padding' => 2,
'tail_end_width' => 20,'font_size'=> 7, 'font'=>'Arial'
],
],
];
/* $values = array(
array('Dough' => 30, 'Ray' => 20, 'Me' => 20, 'Sonnyboy' => 25, 'Far' => 25, 'Lard' => 12),
);
*/
$settings['structured_data'] = true;
$values = array(
array('2010',61342,62038),
array('2011',62092,61420),
array('2012',61912,63348),
array('2013',63253,64217),
array('2014',64573,63045),
array('2015',65602,68065),
array('2016',66083,64089),
array('2017',65721,65887),
array('2018',66145,66069),
array('2019',66271,66810),
array('2020',67067,73774),
);
$graph = new Goat1000\SVGGraph\SVGGraph(400, 300, $settings);
$graph->colourRangeHexHSL(9, '#f00', '#500', true);
$graph->values($values);
$graph->render('GroupedBarGraph');
?>