Note: You are currently viewing documentation for Moodle 3.1. Up-to-date documentation for the latest stable version of Moodle is probably available here: lib/graphlib.php.

Development:lib/graphlib.php: Difference between revisions

From MoodleDocs
No edit summary
 
mNo edit summary
 
Line 7: Line 7:
In the examples you need to replace :
In the examples you need to replace :


<pre>
include 'graph.php';  
include 'graph.php';  
</pre>


with :
with :


<pre>
include '../config.php';
include '../config.php';
include $CFG->dirroot.'/lib/graphlib.php';
include $CFG->dirroot.'/lib/graphlib.php';
</pre>


You don't need this assignment in Moodle :
You don't need this assignment in Moodle :


<pre>
$chart->parameter['path_to_fonts'] = 'fonts/'; // path to where fonts are stored
$chart->parameter['path_to_fonts'] = 'fonts/'; // path to where fonts are stored
 
</pre>


This is handled properly by Moodle modifications of the class for the current language.
This is handled properly by Moodle modifications of the class for the current language.

Latest revision as of 07:28, 13 May 2008

Moodle's graphlib.php is 'Class: Graph Drawing Class 2' by Herman Veluwenkamp with a couple of small modifications.

The modifications tell graphlib where to fetch the fonts for the current language.

There are some examples of how to use the class to make various graphs at the bottom of this page.

In the examples you need to replace :

include 'graph.php'; 

with :

include '../config.php';
include $CFG->dirroot.'/lib/graphlib.php';

You don't need this assignment in Moodle :

$chart->parameter['path_to_fonts'] = 'fonts/'; // path to where fonts are stored

This is handled properly by Moodle modifications of the class for the current language.