@@ -44,6 +44,8 @@ class BlockEvaluationGraph extends Block {
44
44
public function __construct ($ user_id ) {
45
45
$ this ->path = 'block_evaluation_graph ' ;
46
46
$ this ->user_id = $ user_id ;
47
+ $ this ->bg_width = 450 ;
48
+ $ this ->bg_height = 350 ;
47
49
if ($ this ->is_block_visible_for_user ($ user_id )) {
48
50
/*if (api_is_platform_admin()) {
49
51
$this->courses = CourseManager::get_real_course_list();
@@ -157,7 +159,7 @@ public function get_evaluations_base_courses_graph() {
157
159
$ data_set ->AddPoint ($ avg , "Avg " );
158
160
$ data_set ->AddPoint ($ min , "Min " );
159
161
$ data_set ->AddPoint ($ items , "Items " );
160
- $ data_set ->SetXAxisName (get_lang ('Step ' ));
162
+ $ data_set ->SetXAxisName (get_lang ('EvaluationName ' ));
161
163
$ data_set ->SetYAxisName (get_lang ('Percentage ' ));
162
164
$ data_set ->AddAllSeries ();
163
165
$ data_set ->RemoveSerie ("Items " );
@@ -171,28 +173,31 @@ public function get_evaluations_base_courses_graph() {
171
173
$ img_file = $ cache ->GetHash ($ graph_id , $ data );
172
174
} else {
173
175
// Initialise the graph
174
- $ test = new pChart (450 , 260 );
176
+ $ test = new pChart ($ this -> bg_width , $ this -> bg_height );
175
177
$ test ->setFontProperties (api_get_path (LIBRARY_PATH ).'pchart/fonts/tahoma.ttf ' ,8 );
176
- $ test ->setGraphArea (50 ,30 ,375 , 200 );
177
- $ test ->drawFilledRoundedRectangle (7 ,7 ,373 , 223 ,5 ,240 ,240 ,240 );
178
- $ test ->drawRoundedRectangle (5 ,5 ,375 , 225 ,5 ,230 ,230 ,230 );
178
+ $ test ->setGraphArea (50 ,30 ,$ this -> bg_width - 75 , $ this -> bg_height - 75 );
179
+ $ test ->drawFilledRoundedRectangle (7 ,7 ,$ this -> bg_width - 20 , $ this -> bg_height - 20 ,5 ,240 ,240 ,240 );
180
+ $ test ->drawRoundedRectangle (5 ,5 ,$ this -> bg_width - 18 , $ this -> bg_height - 18 ,5 ,230 ,230 ,230 );
179
181
$ test ->drawGraphArea (255 ,255 ,255 ,TRUE );
180
182
$ test ->setFixedScale (0 ,100 ,5 );
181
183
$ test ->drawScale ($ data_set ->GetData (),$ data_set ->GetDataDescription (),SCALE_ADDALL ,150 ,150 ,150 ,TRUE ,0 ,2 ,TRUE );
182
- $ test ->setColorPalette (0 ,125 , 201 , 44 );
183
- $ test ->setColorPalette (1 ,255 ,138 , 0 );
184
+ $ test ->setColorPalette (0 ,105 , 221 , 34 );
185
+ $ test ->setColorPalette (1 ,255 ,135 , 30 );
184
186
$ test ->setColorPalette (2 ,255 ,0 ,0 );
185
187
$ test ->drawGrid (4 ,TRUE ,230 ,230 ,230 ,50 );
186
188
// Draw the 0 line
187
189
$ test ->setFontProperties (api_get_path (LIBRARY_PATH ).'pchart/fonts/tahoma.ttf ' ,6 );
188
190
$ test ->drawTreshold (0 ,143 ,55 ,72 ,TRUE ,TRUE );
189
191
// Draw the bar graph
190
- $ test ->drawOverlayBarGraph ($ data_set ->GetData (),$ data_set ->GetDataDescription (), 100 );
192
+ $ test ->drawOverlayBarGraph ($ data_set ->GetData (),$ data_set ->GetDataDescription (), 90 );
191
193
// Finish the graph
192
194
$ test ->setFontProperties (api_get_path (LIBRARY_PATH ).'pchart/fonts/tahoma.ttf ' ,8 );
193
- $ test ->drawLegend (365 ,20 ,$ data_set ->GetDataDescription (),255 ,255 ,255 );
195
+ $ test ->drawLegend ($ this -> bg_width - 80 ,20 ,$ data_set ->GetDataDescription (),255 ,255 ,255 );
194
196
$ test ->setFontProperties (api_get_path (LIBRARY_PATH ).'pchart/fonts/tahoma.ttf ' ,10 );
195
197
//$test->drawTitle(50,22,$course_code,50,50,50,185);
198
+ $ test ->setColorPalette (0 ,50 ,50 ,50 );
199
+ $ test ->setColorPalette (1 ,50 ,50 ,50 );
200
+ $ test ->setColorPalette (2 ,50 ,50 ,50 );
196
201
$ test ->writeValues ($ data_set ->GetData (),$ data_set ->GetDataDescription (),array ("Min " , "Max " , "Avg " ));
197
202
$ cache ->WriteToCache ($ graph_id , $ data_set ->GetData (), $ test );
198
203
ob_start ();
@@ -243,7 +248,7 @@ public function get_evaluations_courses_in_sessions_graph() {
243
248
$ data_set ->AddPoint ($ avg , "Avg " );
244
249
$ data_set ->AddPoint ($ min , "Min " );
245
250
$ data_set ->AddPoint ($ items , "Items " );
246
- $ data_set ->SetXAxisName (get_lang ('Step ' ));
251
+ $ data_set ->SetXAxisName (get_lang ('EvaluationName ' ));
247
252
$ data_set ->SetYAxisName (get_lang ('Percentage ' ));
248
253
$ data_set ->AddAllSeries ();
249
254
$ data_set ->RemoveSerie ("Items " );
@@ -257,17 +262,17 @@ public function get_evaluations_courses_in_sessions_graph() {
257
262
$ img_file = $ cache ->GetHash ($ graph_id , $ data );
258
263
} else {
259
264
// Initialise the graph
260
- $ test = new pChart (450 , 260 );
265
+ $ test = new pChart ($ this -> bg_width , $ this -> bg_height );
261
266
$ test ->setFontProperties (api_get_path (LIBRARY_PATH ).'pchart/fonts/tahoma.ttf ' ,8 );
262
- $ test ->setGraphArea (50 ,30 ,375 , 200 );
263
- $ test ->drawFilledRoundedRectangle (7 ,7 ,373 , 230 ,5 ,240 ,240 ,240 );
264
- $ test ->drawRoundedRectangle (5 ,5 ,375 , 225 ,5 ,230 ,230 ,230 );
267
+ $ test ->setGraphArea (50 ,30 ,$ this -> bg_width - 75 , $ this -> bg_height - 75 );
268
+ $ test ->drawFilledRoundedRectangle (7 ,7 ,$ this -> bg_width - 20 , $ this -> bg_height - 20 ,5 ,240 ,240 ,240 );
269
+ $ test ->drawRoundedRectangle (5 ,5 ,$ this -> bg_width - 18 , $ this -> bg_height - 18 ,5 ,230 ,230 ,230 );
265
270
$ test ->drawGraphArea (255 ,255 ,255 ,TRUE );
266
271
$ test ->setFixedScale (0 ,100 ,5 );
267
272
$ test ->drawScale ($ data_set ->GetData (),$ data_set ->GetDataDescription (),SCALE_ADDALL ,150 ,150 ,150 ,TRUE ,0 ,2 ,TRUE );
268
- $ test ->setColorPalette (0 ,125 , 201 , 44 );
269
- $ test ->setColorPalette (1 ,255 ,138 , 0 );
270
- $ test ->setColorPalette (2 ,255 ,0 ,0 );
273
+ $ test ->setColorPalette (0 ,105 , 221 , 34 );
274
+ $ test ->setColorPalette (1 ,255 ,135 , 30 );
275
+ $ test ->setColorPalette (2 ,255 ,0 ,0 );
271
276
$ test ->drawGrid (4 ,TRUE ,230 ,230 ,230 ,50 );
272
277
// Draw the 0 line
273
278
$ test ->setFontProperties (api_get_path (LIBRARY_PATH ).'pchart/fonts/tahoma.ttf ' ,6 );
@@ -276,8 +281,11 @@ public function get_evaluations_courses_in_sessions_graph() {
276
281
$ test ->drawOverlayBarGraph ($ data_set ->GetData (),$ data_set ->GetDataDescription (), 100 );
277
282
// Finish the graph
278
283
$ test ->setFontProperties (api_get_path (LIBRARY_PATH ).'pchart/fonts/tahoma.ttf ' ,8 );
279
- $ test ->drawLegend (365 ,20 ,$ data_set ->GetDataDescription (),255 ,255 ,255 );
284
+ $ test ->drawLegend ($ this -> bg_width - 80 ,20 ,$ data_set ->GetDataDescription (),255 ,255 ,255 );
280
285
$ test ->setFontProperties (api_get_path (LIBRARY_PATH ).'pchart/fonts/tahoma.ttf ' ,10 );
286
+ $ test ->setColorPalette (0 ,50 ,50 ,50 );
287
+ $ test ->setColorPalette (1 ,50 ,50 ,50 );
288
+ $ test ->setColorPalette (2 ,50 ,50 ,50 );
281
289
$ test ->writeValues ($ data_set ->GetData (),$ data_set ->GetDataDescription (),array ("Min " , "Max " , "Avg " ));
282
290
$ cache ->WriteToCache ($ graph_id , $ data_set ->GetData (), $ test );
283
291
ob_start ();
0 commit comments