Different shapes
The code below is the source for this graph.
<?php
// Different shapes
require_once 'SVGGraph/autoloader.php';
$settings = [
'auto_fit' => true,
'show_tooltips' => false,
'back_stroke_width' => 0,
'marker_size' => 2,
'marker_type' => 'square',
'grid_back_colour' => '#f9f9f9',
'pad_left' => 5,
'pad_top' => 5,
'pad_right' => 5,
'pad_bottom' => 5,
'axis_max_v' => 1000,
'axis_max_h' => 12,
'figure' => [
['complex',
['rect', 'x' => -20, 'y' => -20, 'width' => 40, 'height' => 40,
'fill' => 'red'],
['rect', 'x' => -10, 'y' => -15, 'width' => 20, 'height' => 30,
'fill' => 'white', 'transform' => 'rotate(45)'],
['rect', 'x' => -10, 'y' => -15, 'width' => 20, 'height' => 30,
'fill' => ['red', 'white'], 'transform' => 'rotate(135)'],
],
],
'shape' => [
['circle', 'cx' => 'g1', 'cy' => 'g900', 'r' => 10,
'stroke-width' => 2, 'fill' => '#66f'],
['ellipse', 'cx' => 'g1', 'cy' => 'g750', 'rx' => 20, 'ry' => 10,
'stroke-width' => 2, 'fill' => '#6f6'],
['rect', 'x' => 'g2', 'y' => 'g950', 'width' => 'u2', 'height' => 'u100',
'stroke-width' => 2, 'fill' => '#ff6'],
['line', 'x1' => 'g2', 'y1' => 'g800', 'x2' => 'g4', 'y2' => 'g700',
'stroke-width' => 3, 'stroke' => '#f0f'],
['polyline',
'points' => [ 'g0.5', 'g650', 'g1.5', 'g600', 'g1', 'g575', 'g0.5', 'g600' ],
'stroke-width' => 3, 'stroke' => '#0c9'],
['polygon',
'points' => [ 'g0.5', 'g500', 'g1.5', 'g450', 'g1', 'g425', 'g0.5', 'g450', ],
'stroke-width' => 3, 'stroke' => '#f66'],
['polygon',
'points' => [ 'g4.5', 'g600', 'g11', 'g1200', 'g12', 'g600', 'g5', 'g300', ],
'fill' => ['#f00', '#fcc'], 'fill-opacity' => 0.9,
'stroke' => '#00f', 'stroke-width' => 2,
'stroke-dasharray' => '3,2', 'clip_to_grid' => true, ],
['figure', 'x' => 'g6', 'y' => 'g200', 'name' => 'complex'],
['figure', 'x' => 'g7', 'y' => 'g180', 'name' => 'complex'],
['figure', 'x' => 'g8', 'y' => 'g220', 'name' => 'complex'],
['image', 'x' => 'g9.5', 'y' => 'g300',
'src' => getenv('base') . '/images/64x64/icon-05.png'],
['marker', 'x' => 'g9', 'y' => 'g300', 'type' => 'star', 'size' => 20],
],
];
$values = [80, 100, 220, 300, 430, 500, 600, 650, 700, 850, 900];
$graph = new Goat1000\SVGGraph\SVGGraph(670, 400, $settings);
$graph->colours(['#e11','#1b1','#11e','#e71','#333']);
$graph->values($values);
$graph->render('LineGraph', false);
Please note: the source code above comes from a script used to generate one of the example graphs on the site. This is simply a wrapper page to apply highlighting and make the source code easier to read, so there is no content here to describe what the source code is doing.