diff --git a/main/gradebook/lib/fe/flatviewtable.class.php b/main/gradebook/lib/fe/flatviewtable.class.php index 4551fe68df..7df3479ab0 100644 --- a/main/gradebook/lib/fe/flatviewtable.class.php +++ b/main/gradebook/lib/fe/flatviewtable.class.php @@ -106,9 +106,12 @@ class FlatViewTable extends SortableTable // the graph id $gradebook_id = Security::remove_XSS($_GET['selectcat']); $graph_id = api_get_user_id().'AverageResultsVsResource'.$gradebook_id.api_get_course_id(); - + $data = $DataSet->GetData(); + + if ($show_draw) { if ($Cache->IsInCache($graph_id, $DataSet->GetData())) { + //if (0) { //if we already created the img //echo 'in cache'; $img_file = $Cache->GetHash($graph_id,$DataSet->GetData()); @@ -118,8 +121,14 @@ class FlatViewTable extends SortableTable // Initialise the graph $Test = new pChart(760,360); + //which schema of color will be used + $quant_resources = count($data[0])-1; // Adding the color schemma - $Test->loadColorPalette(api_get_path(LIBRARY_PATH)."pchart/palette/default.txt"); + if ($quant_resources < 8) { + $Test->loadColorPalette(api_get_path(LIBRARY_PATH)."pchart/palette/reduced.txt"); + } else { + $Test->loadColorPalette(api_get_path(LIBRARY_PATH)."pchart/palette/default.txt"); + } // set font of the axes $Test->setFontProperties(api_get_path(LIBRARY_PATH)."pchart/fonts/tahoma.ttf",8); @@ -319,6 +328,8 @@ class FlatViewTable extends SortableTable $i++; } } //end foreach + } else { + echo get_lang('ToViewGraphScoreRuleMustBeEnabled'); } // Pie charts /* diff --git a/main/inc/lib/pchart/palette/reduced.txt b/main/inc/lib/pchart/palette/reduced.txt new file mode 100644 index 0000000000..08cb5208ed --- /dev/null +++ b/main/inc/lib/pchart/palette/reduced.txt @@ -0,0 +1,7 @@ +189,250,75 +204,203,81 +220,155,87 +235,108,92 +250,60,98 +176,46,224 +46,151,224 \ No newline at end of file diff --git a/main/inc/lib/pchart/palette/soft_tones.txt b/main/inc/lib/pchart/palette/soft_tones.txt new file mode 100644 index 0000000000..b9b8989ca6 --- /dev/null +++ b/main/inc/lib/pchart/palette/soft_tones.txt @@ -0,0 +1,5 @@ +168,188,56 +188,208,76 +208,228,96 +228,245,116 +248,255,136 \ No newline at end of file