Line figures

The code below is the source for this graph.

<?php
// Line figures
require_once 'SVGGraph/autoloader.php';

$settings = [
  'back_stroke_width' => 0,
  'auto_fit' => true,
  'line_figure' => true,
  'line_figure_closed' => [false, true],
  'structure' => ['key' => 0, 'value' => [1, 2]],
  'fill_under' => true,
  'marker_size' => 2,
  'axis_max_h' => 300,
  'axis_max_v' => 300,
  'minimum_grid_spacing' => 30,
  'graph_title' => 'Did you see that ludicrous display last night?',
  'graph_title_space' => 0,
  'graph_title_font' => 'Arial',
];

$type = 'MultiLineGraph';

$values = [
  [27,223],
  [34,240],
  [43,208],
  [77,239],
  [118,177],
  [155,154],
  [166,214],
  [215,166],
  [199,153],
  [181,173],
  [179,122],
  [130,131],
  [147,106],
  [197,114],
  [202,45],
  [178,45],
  [178,90],
  [148,78],
  [160,38],
  [125,33],
  [115,70],
  [54,74],
  [33,136],
  [50,146],
  [65,94],
  [87,97],
  [98,148],
  [78,207],
  [38,177],
];

foreach($values as $k => $v) {
  $values[$k][1] = 300 - $v[1];
}

$pos_x = 240;
$pos_y = 70;
$rad_x = 35;
$rad_y = 50;
$steps = 13;
for($i = 0; $i < 360; $i += 360 / $steps) {
  $a = deg2rad($i);
  $values[] = [
    0 => $pos_x + $rad_x * sin($a),
    2 => $pos_y + $rad_y * cos($a)
  ];
}

$graph = new Goat1000\SVGGraph\SVGGraph(600, 200, $settings);
$graph->values($values);
$graph->render($type);

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.