Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.
/lib/ -> graphlib.php (source)

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

Graph Class. PHP Class to draw line, point, bar, and area graphs, including numeric x-axis and double y-axis. Version: 1.6.3 Copyright (C) 2000  Herman Veluwenkamp This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

File Size: 1897 lines (89 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

graph:: (25 methods):
  init()
  draw_text()
  draw_stack()
  draw()
  draw_set()
  draw_data()
  draw_legend()
  draw_y_label_right()
  draw_y_label_left()
  draw_title()
  draw_x_label()
  draw_zero_axis_left()
  draw_zero_axis_right()
  draw_x_axis()
  draw_y_axis()
  init_data()
  init_x_ticks()
  init_y_ticks()
  init_labels()
  init_legend()
  init_y_axis()
  init_x_axis()
  find_range()
  __construct()
  graph()

name:: (16 methods):
  prepare_label_text()
  print_TTF()
  update_boundaryBox()
  get_null_size()
  get_boundaryBox()
  draw_rectangle()
  init_colours()
  output()
  init_variable()
  plot()
  bar()
  area()
  line()
  draw_brush_line()
  draw_brush()
  image_dashed_line()


Class: graph  - X-Ref


init()   X-Ref
No description

draw_text()   X-Ref
No description

draw_stack()   X-Ref
No description

draw()   X-Ref
No description

draw_set($order, $set, $offset)   X-Ref
No description

draw_data()   X-Ref
No description

draw_legend()   X-Ref
No description

draw_y_label_right()   X-Ref
No description

draw_y_label_left()   X-Ref
No description

draw_title()   X-Ref
No description

draw_x_label()   X-Ref
No description

draw_zero_axis_left()   X-Ref
No description

draw_zero_axis_right()   X-Ref
No description

draw_x_axis()   X-Ref
No description

draw_y_axis()   X-Ref
No description

init_data()   X-Ref
No description

init_x_ticks()   X-Ref
No description

init_y_ticks()   X-Ref
No description

init_labels()   X-Ref
No description

init_legend()   X-Ref
No description

init_y_axis()   X-Ref
No description

init_x_axis()   X-Ref
No description

find_range($data, $min, $max, $resolution)   X-Ref
No description

__construct()   X-Ref
No description

graph()   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

prepare_label_text($label)   X-Ref
Prepare label's text for GD output.

param: string    $label string to be prepared.
return: string   Reversed input string, if we are in RTL mode and has no numbers.

print_TTF($message)   X-Ref
No description

update_boundaryBox(&$boundaryBox, $coords)   X-Ref
No description

get_null_size()   X-Ref
No description

get_boundaryBox($message)   X-Ref
No description

draw_rectangle($border, $colour, $type)   X-Ref
No description

init_colours()   X-Ref
No description

output()   X-Ref
No description

init_variable(&$variable, $value, $default)   X-Ref
No description

plot($x, $y, $type, $size, $colour, $offset)   X-Ref
No description

bar($x, $y, $type, $size, $colour, $offset, $index, $yoffset)   X-Ref
No description

area($x_start, $y_start, $x_end, $y_end, $type, $colour, $offset)   X-Ref
No description

line($x_start, $y_start, $x_end, $y_end, $type, $brush_type, $brush_size, $colour, $offset)   X-Ref
No description

draw_brush_line($x0, $y0, $x1, $y1, $size, $type, $colour)   X-Ref
No description

draw_brush($x, $y, $size, $type, $colour)   X-Ref
No description

image_dashed_line($image, $x1, $y1, $x2, $y2, $colour)   X-Ref
Moodle.

A replacement for deprecated ImageDashedLine function.

param: resource|GdImage $image
param: int $x1 — x-coordinate for first point.
param: int $y1 — y-coordinate for first point.
param: int $x2 — x-coordinate for second point.
param: int $y2 — y-coordinate for second point.
param: int $color
return: void