Changing Overview Graph

Changing Overview Graph

by Josh K. -
Number of replies: 0
Hey Guys,

I am trying to change the Overview Graph so that it shows me all Courses of a single User on the X-Axis (Course1, Course2...) and the Points of each Course on the Y-Axis (1...100 Points).

I had no problem changing the X-Axis, but have no idea how to change the Y-Axis because there are parts of the code that i didn't find in graphlib.php and don't even now what they are doing...

I have to change the following code parts:


$line->y_format['allusers'] = array(
'colour' => 'red',
'bar' => 'fill',
'shadow_offset' => 1,
'legend' => get_string('allparticipants')
);
$line->y_data['allusers'] = quiz_report_grade_bands($bandwidth, $bands, $quizid, $groupusers);

$line->y_order = array('allusers');

$ymax = max($line->y_data['allusers']);
$line->parameter['y_min_left'] = 0;
$line->parameter['y_max_left'] = $ymax;
$line->parameter['y_decimal_left'] = 0;

// Pick a sensible number of gridlines depending on max value on graph.
$gridlines = $ymax;
while ($gridlines >= 10) {
if ($gridlines >= 50) {
$gridlines /= 5;
} else {
$gridlines /= 2;
}
}


When I change the slightest here, the graph image isn't showing anymore..

I think it has to do with ['allusers'].

Can someone explain to me what I have to do with y_data to change the Y-Axis?


What I did was simply like I have done in the X-Axis before:

X-Axis

        for ($i=0; $i<=($SESSION['coursecount'] -1); $i++) {

            $bandlabels[] = $_SESSION['coursename'][$i];

        }

        $line->x_data = $bandlabels;


Y-Axis

      $bandlabels_y = array ();

        for($j=0; $j<=100; $j+=10) {

            bandlabels_y [] = $j;    //to show the points like: "0, 10, 20, 30,...,100"

        }

in the moodle overviewgraph this line looks like that:

        $line->y_data['allusers'] = quiz_report_grade_bands($bandwidth, $bands,    $quizid, $groupusers);


I just have no idea what to do with ['allusers'] ???

Could need some help heresad

Average of ratings: -