Axis levels example

The code below is the source for this graph.

<?php
// Axis levels example
require_once 'SVGGraph/autoloader.php';

$settings = [
  'back_stroke_width' => 0,
  'auto_fit' => true,
  'axis_font' => 'Arial',
  'axis_font_size' => 12,
  'axis_font_weight' => 'bold',
  'axis_text_space' => 5,
  'grid_division_v' => 20,
  'bar_space' => 20,
  'stroke_width' => 2,
  'stroke_colour' => 'fillColour/brightness(-20%)',
  'division_style' => 'box',
  'axis_levels_h' => 3,
  'structure' => [
    'key' => 0, 'value' => 1,
    'axis_text' => [2, 3, 4],
  ],
];

$values = [
  [0, 55, 'Nov', 'Q4', '2018'],
  [1, 34, 'Dec', 'Q4', '2018'],
  [2, 155, 'Jan', 'Q1', '2019'],
  [3, 98, 'Feb', 'Q1', '2019'],
  [4, 122, 'Mar', 'Q1', '2019'],
  [5, 85, 'Apr', 'Q2', '2019'],
  [6, 94, 'May', 'Q2', '2019'],
  [7, 112, 'Jun', 'Q2', '2019'],
  [8, 120, 'Jul', 'Q3', '2019'],
  [9, 88, 'Aug', 'Q3', '2019'],
];

$colours = [
  'red/saturation(180%)/brightness(150%)',
  'green/saturation(180%)/brightness(150%)',
  'blue/saturation(180%)/brightness(150%)',
];

$graph = new Goat1000\SVGGraph\SVGGraph(670, 300, $settings);
$graph->values($values);
$graph->colours($colours);
$graph->render('Bar3DGraph');

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.