7. Vertical line

The code below is the source for this graph.

<?php
// 7. Vertical line
require_once 'SVGGraph/autoloader.php';

$lunch_start = 60;
$lunch_end = 72;
$lunch_start = '13:00';
$lunch_end = '14:00';

$settings = [
  'auto_fit' => true,
  'back_colour' => '#eee',
  'back_stroke_width' => 0,
  'back_stroke_colour' => '#eee',
  'stroke_colour' => '#669',
  'axis_colour' => '#333',
  'axis_overlap' => 3,
  'grid_colour' => '#bbb',
  'label_colour' => '#000',
  'axis_font' => 'Arial',
  'axis_font_size' => 10,
  'pad_right' => 10,
  'pad_left' => 10,
  'marker_type' => 'circle',
  'marker_size' => 0,
  'marker_colour' => 'blue',
  'minimum_grid_spacing' => 20,
  'axis_min_v' => 1700,
  'axis_max_v' => 2000,
  'axis_max_h' => 99,
  'axis_text_angle_h' => 90,
  'grid_division_h' => 12,
  'show_subdivisions' => true,
  'show_grid_subdivisions' => true,
  'grid_subdivision_colour' => '#ddd',
  'subdivision_v' => 25,
  'guideline' => [
    [1853, "Close:\n1853"],
    [1723, 'Year minimum', 'colour' => 'red'],
    [1958, 'Year maximum', 'colour' => 'blue'],
    [$lunch_start, "Lunch\nbreak", 'x', 
    'stroke_width' => 2, 'dash' => '3',
    'text_position' => 'bottom right -3 -15',
    'text_angle' => -90,
    'font' => 'Arial',],
  ],
  'fill_under' => true,
  'fill_opacity' => 0.9,
  'guideline_text_position' => 'top left',
  'guideline_font' => 'Georgia',
  'guideline_dash' => "1,2",
];

$width = 300;
$height = 200;
$type = 'LineGraph';

$values = unserialize('a:109:{s:5:"08:00";i:1812;s:5:"08:05";i:1823;s:5:"08:10";i:1827;s:5:"08:15";i:1806;s:5:"08:20";i:1823;s:5:"08:25";i:1794;s:5:"08:30";i:1785;s:5:"08:35";i:1784;s:5:"08:40";i:1812;s:5:"08:45";i:1820;s:5:"08:50";i:1801;s:5:"08:55";i:1796;s:5:"09:00";i:1824;s:5:"09:05";i:1827;s:5:"09:10";i:1843;s:5:"09:15";i:1848;s:5:"09:20";i:1850;s:5:"09:25";i:1833;s:5:"09:30";i:1824;s:5:"09:35";i:1842;s:5:"09:40";i:1849;s:5:"09:45";i:1828;s:5:"09:50";i:1840;s:5:"09:55";i:1818;s:5:"10:00";i:1818;s:5:"10:05";i:1827;s:5:"10:10";i:1802;s:5:"10:15";i:1833;s:5:"10:20";i:1849;s:5:"10:25";i:1852;s:5:"10:30";i:1879;s:5:"10:35";i:1851;s:5:"10:40";i:1834;s:5:"10:45";i:1828;s:5:"10:50";i:1827;s:5:"10:55";i:1809;s:5:"11:00";i:1809;s:5:"11:05";i:1814;s:5:"11:10";i:1836;s:5:"11:15";i:1847;s:5:"11:20";i:1815;s:5:"11:25";i:1817;s:5:"11:30";i:1840;s:5:"11:35";i:1826;s:5:"11:40";i:1851;s:5:"11:45";i:1841;s:5:"11:50";i:1839;s:5:"11:55";i:1837;s:5:"12:00";i:1835;s:5:"12:05";i:1831;s:5:"12:10";i:1835;s:5:"12:15";i:1839;s:5:"12:20";i:1818;s:5:"12:25";i:1834;s:5:"12:30";i:1824;s:5:"12:35";i:1847;s:5:"12:40";i:1853;s:5:"12:45";i:1877;s:5:"12:50";i:1852;s:5:"12:55";i:1840;s:5:"13:00";N;s:5:"13:05";N;s:5:"13:10";N;s:5:"13:15";N;s:5:"13:20";N;s:5:"13:25";N;s:5:"13:30";N;s:5:"13:35";N;s:5:"13:40";N;s:5:"13:45";N;s:5:"13:50";N;s:5:"13:55";N;s:5:"14:00";N;s:5:"14:05";i:1890;s:5:"14:10";i:1858;s:5:"14:15";i:1896;s:5:"14:20";i:1908;s:5:"14:25";i:1918;s:5:"14:30";i:1892;s:5:"14:35";i:1862;s:5:"14:40";i:1871;s:5:"14:45";i:1890;s:5:"14:50";i:1854;s:5:"14:55";i:1832;s:5:"15:00";i:1843;s:5:"15:05";i:1851;s:5:"15:10";i:1844;s:5:"15:15";i:1842;s:5:"15:20";i:1824;s:5:"15:25";i:1837;s:5:"15:30";i:1834;s:5:"15:35";i:1836;s:5:"15:40";i:1813;s:5:"15:45";i:1813;s:5:"15:50";i:1817;s:5:"15:55";i:1824;s:5:"16:00";i:1821;s:5:"16:05";i:1796;s:5:"16:10";i:1810;s:5:"16:15";i:1803;s:5:"16:20";N;s:5:"16:25";N;s:5:"16:30";N;s:5:"16:35";N;s:5:"16:40";N;s:5:"16:45";N;s:5:"16:50";N;s:5:"16:55";N;s:5:"17:00";N;}');

$colours = [ ['yellow', 'white'] ];

$graph = new Goat1000\SVGGraph\SVGGraph($width, $height, $settings);
$graph->colours($colours);
$graph->values($values);
$graph->render($type, 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.

This site uses cookies - details here.