<?php

    $path = "../libraries/";                //Define default path
    require_once $path."configuration.php";
	require_once $path."external/charts.php";
	
	$id = $_GET['id'];
	switch ($id) {
		case 2:case 3:	                                                            //kind of questions  in tests
		    try {
    		    $lesson      = new EfrontLesson($_GET['lesson_id']);
    		    $lessonTests = $lesson -> getTests();
        		if (!in_array($_GET['test_id'], $lessonTests)) {
        		    exit;
        		}
    		    if (isset($_GET['show'])) {
    		        $id == 2 ? $chart = swf_createPieQuestionsKind($_GET['test_id']) : $chart = swf_createPieQuestionsDifficulty($_GET['test_id']);
    			    SendChartData($chart);
    		    } else {
        			$source = $_SERVER['PHP_SELF']."?show=1&id=2&lesson_id=".$_GET['lesson_id']."&test_id=".$_GET['test_id'];	
        			echo InsertChart ("charts.swf", "charts_library", $source, 600, 300, "ffffff");
        			$source = $_SERVER['PHP_SELF']."?show=1&id=3&lesson_id=".$_GET['lesson_id']."&test_id=".$_GET['test_id'];	
        			echo InsertChart ("charts.swf", "charts_library", $source, 600, 300, "ffffff");		        
    		    }
		    } catch (Exception $e) {
                $smarty -> assign("T_EXCEPTION_TRACE", $e -> getTraceAsString());
                $message      = $e -> getMessage().' ('.$e -> getCode().') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(\''._ERRORDETAILS.'\', 2, \'error_details\')">'._MOREINFO.'</a>';
                $message_type = 'failure';                
		    }
			break;
		
		case 4:                                    	//kind of questions  in tests
		    if (isset($_GET['show'])) {
		        $chart  = swf_createColumnUserTypes($_GET['lesson_id']);
                SendChartData ($chart);
            } else {
    			$source = "show_chart.php?show=1&id=4&lesson_id=".$_GET['lesson_id'];
    			echo InsertChart ("charts.swf", "charts_library", $source, 700, 400, "ffffff" );                
            }		    
		    break;
		
		case 5:                                    	//5 most active users in a lesson (per period)
		    if (isset($_GET['show'])) {
		        $chart  = swf_createBarActiveUsers($_GET['lesson_id'], $_GET['from'], $_GET['to']);
                SendChartData ($chart);
            } else {
    			$source = "show_chart.php?show=1&id=5&lesson_id=".$_GET['lesson_id']."&from=".$_GET['from']."&to=".$_GET['to'];
    			echo InsertChart ("charts.swf", "charts_library", $source, 700, 400, "ffffff" );                
            }		    
			break;
			
		case 6:
		    try {
                if (isset($_GET['show'])) {
                    $chart  = swf_createBarSystemActiveUsers(explode(",", $_GET['logins']), explode(",", $_GET['seconds']));
                    SendChartData ($chart);
                } else {
        			$source = "show_chart.php?show=1&id=6&logins=".$_GET['logins']."&seconds=".$_GET['seconds'];
        			echo InsertChart ("charts.swf", "charts_library", $source, 700, 400, "ffffff" );                
                }
		    } catch (Exception $e) {
                $smarty -> assign("T_EXCEPTION_TRACE", $e -> getTraceAsString());
                $message      = $e -> getMessage().' ('.$e -> getCode().') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(\''._ERRORDETAILS.'\', 2, \'error_details\')">'._MOREINFO.'</a>';
                $message_type = 'failure';                
		    }		    
			break;
			
        case 8:	//lesson access through time
            try {
                if (isset($_GET['show'])) {
                    $chart  = swf_createLineAccessTime($_GET['lesson_id'], $_GET['from'], $_GET['to']);
                    SendChartData ($chart);
                } else {
        			$source = "show_chart.php?show=1&id=8&lesson_id=".$_GET['lesson_id']."&from=".$_GET['from']."&to=".$_GET['to'];
        			echo InsertChart ("charts.swf", "charts_library", $source, 700, 400, "ffffff" );                
                }
		    } catch (Exception $e) {
                $smarty -> assign("T_EXCEPTION_TRACE", $e -> getTraceAsString());
                $message      = $e -> getMessage().' ('.$e -> getCode().') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(\''._ERRORDETAILS.'\', 2, \'error_details\')">'._MOREINFO.'</a>';
                $message_type = 'failure';                
		    }
            break;
	
        case 9:	//system logins through time
            try {
                if (isset($_GET['show'])) {
                    $chart  = swf_createLineLoginTime($_GET['from'], $_GET['to']);
                    SendChartData ($chart);
                } else {
        			$source = "show_chart.php?show=1&id=9&from=".$_GET['from']."&to=".$_GET['to'];
        			echo InsertChart ("charts.swf", "charts_library", $source, 700, 400, "ffffff" );                
                }
		    } catch (Exception $e) {
                $smarty -> assign("T_EXCEPTION_TRACE", $e -> getTraceAsString());
                $message      = $e -> getMessage().' ('.$e -> getCode().') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(\''._ERRORDETAILS.'\', 2, \'error_details\')">'._MOREINFO.'</a>';
                $message_type = 'failure';                
		    }
            break;

        case 10:
            try {
                if (isset($_GET['show'])) {
                    $chart  = swf_createLineAccessLesson($_GET['lesson_id'], $_GET['from'], $_GET['to'], $_GET['login']);
                    SendChartData ($chart);
                } else {
        			$source = "show_chart.php?show=1&id=10&lesson_id=".$_GET['lesson_id']."&from=".$_GET['from']."&to=".$_GET['to']."&login=".$_GET['login'];
        			echo InsertChart ("charts.swf", "charts_library", $source, 700, 400, "ffffff" );                
                }            
		    } catch (Exception $e) {
                $smarty -> assign("T_EXCEPTION_TRACE", $e -> getTraceAsString());
                $message      = $e -> getMessage().' ('.$e -> getCode().') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(\''._ERRORDETAILS.'\', 2, \'error_details\')">'._MOREINFO.'</a>';
                $message_type = 'failure';                
		    }            
			break;
        	
        case 11:
            try {
                if (isset($_GET['show'])) {
                    $chart  = swf_createLineUserLogin($_GET['from'], $_GET['to'], $_GET['login']);
                    SendChartData ($chart);
                } else {
        			$source = "show_chart.php?show=1&id=11&from=".$_GET['from']."&to=".$_GET['to']."&login=".$_GET['login'];
        			echo InsertChart ("charts.swf", "charts_library", $source, 700, 400, "ffffff" );                
                }            
		    } catch (Exception $e) {
                $smarty -> assign("T_EXCEPTION_TRACE", $e -> getTraceAsString());
                $message      = $e -> getMessage().' ('.$e -> getCode().') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(\''._ERRORDETAILS.'\', 2, \'error_details\')">'._MOREINFO.'</a>';
                $message_type = 'failure';                
		    }                        
			break;
        	
	}	
	
	if (isset($message)) {
        $smarty -> assign("T_MESSAGE", $message);
        $smarty -> display('charts.tpl');	    
	}
	
	
	
	
	function swf_createPieQuestionsKind($testId) {
		$stats = EfrontStats :: getTestInfo($testId);
		
		$chart['chart_data'] = array(array(""), array(""));
		foreach (Question :: $questionTypes as $questionType => $typeText) {
		    $chart['chart_data'][0][] = $typeText;
		    $chart['chart_data'][1][] = $stats[$testId]['questions'][$questionType];
		}

		$chart['chart_type']       = 'pie';
		$chart['chart_transition'] = array ('type'	     => 'scale'); 
		$chart['chart_grid_h']     = array ('alpha'		 => 20,    		  'color'      => '000000', 'thickness'      => 1, 		  		   'type'           => 		 'solid');
		$chart['chart_rect']       = array ('width'      => '600', 		  'height'     => '220',	'positive_color' => 'ffffff', 		   'positive_alpha' => 20,   'negative_color' => 'ff0000', 'negative_alpha' => 10);
		$chart['chart_value']      = array ('color'      => 'ffffff', 	  'alpha'      => 90, 		'font'           => 'Times New Roman', 'bold'           => true, 'size'           => 10, 	   'position'       => 'inside', 'prefix' => '', 'suffix' => '', 'decimals' => 0, 'separator' => '', 'as_percentage' => true);
		$chart['legend_label']     = array ('layout'     => 'horizontal', 'bullet'     => 'circle', 'font'           => 'Times New Roman', 'bold'           => true, 'size'           => 13, 	   'color'          => '000000', 'alpha'  => 85); 
		$chart['legend_rect']      = array ('fill_color' => 'ffffff', 	  'fill_alpha' => 10, 		'line_color'     => '000000', 		   'line_alpha'     => 0, 	 'line_thickness' => 0,  	   'height'         => 200); 
		$chart['series_color']     = array ('ddaa41', '88dd11', '4e62dd', 'ff8811', '4d4d4d'); 
		$chart['series_explode']   = array (20, 0, 50);	
					
		return $chart;								
	}	
	
	function swf_createPieQuestionsDifficulty($testId){
		$stats = EfrontStats :: getTestInfo($testId);
		
		$chart['chart_data'] = array(array("", _LOWDIFFICULTY, _MEDIUMDIFFICULTY, _HIGHDIFFICULTY), 
									 array("", $stats[$testId]['questions']['low'],  $stats[$testId]['questions']['medium'],  $$stats[$testId]['questions']['high']));
		
		$chart['chart_type']       = 'pie';
		$chart['chart_transition'] = array ('type'	     => 'scale'); 
		$chart['chart_grid_h']     = array ('alpha'		 => 20,    		  'color'      => '000000', 'thickness'      => 1, 		  		   'type'           => 		 'solid');
		$chart['chart_rect']       = array ('width'      => '600', 		  'height'     => '220',	'positive_color' => 'ffffff', 		   'positive_alpha' => 20,   'negative_color' => 'ff0000', 'negative_alpha' => 10);
		$chart['chart_value']      = array ('color'      => 'ffffff', 	  'alpha'      => 90, 		'font'           => 'Times New Roman', 'bold'           => true, 'size'           => 10, 	   'position'       => 'inside', 'prefix' => '', 'suffix' => '', 'decimals' => 0, 'separator' => '', 'as_percentage' => true);
		$chart['legend_label']     = array ('layout'     => 'horizontal', 'bullet'     => 'circle', 'font'           => 'Times New Roman', 'bold'           => true, 'size'           => 13, 	   'color'          => '000000', 'alpha'  => 85); 
		$chart['legend_rect']      = array ('fill_color' => 'ffffff', 	  'fill_alpha' => 10, 		'line_color'     => '000000', 		   'line_alpha'     => 0, 	 'line_thickness' => 0,  	   'height'         => 200); 
		$chart['series_color']     = array ('ddaa41', '88dd11', '4e62dd', 'ff8811', '4d4d4d'); 
		$chart['series_explode']   = array (20, 0, 50);	
					
		return $chart;										

	}	
	
	function swf_createLineAccessTime($lessonId, $from, $to){
        $traffic = EfrontStats :: getUsersTime($lessonId, false, $from, $to);

        foreach ($traffic as $key => $value) {
            $accesses[] = $value['accesses'];
        }

        $chart['chart_type']       ="line";
        $chart[ 'chart_rect' ]     = array('x' => 40, 'y' => 35, 'width' => 610, 'height' => 300);
		$chart['chart_transition'] = array('type' => "scale"); 
		$chart['series_color']     = array("0000ff");
		$chart['legend_rect']      = array('x' => "-100", 'y' => "-100");
		$chart['axis_category']    = array( 'size' => 14, 'color' => "000000", 'alpha' => 0, 'font' => "Times New Roman", 'bold' => true, 'skip' => 0 ,'orientation' => "horizontal" ); 
		$chart['axis_value' ]      = array('font' => "Times New Roman", 'bold' => true, 'size' => 14, 'color' => "000000", 'alpha' => 50, 'steps' => 6, 'prefix' => "", 'suffix' => "", 'decimals' => 0, 'separator' => "", 'show_min' => true );
		$chart['chart_data']       = array(array_keys($traffic), $accesses);
		$chart['draw']             = array(array('type' => "text", 'color' => "0000ff", 'alpha' => 55, 'font' => "Times New Roman", 'rotation' => 0, 'bold' => true, 'size' => 25, 'x' => 95, 'y' => 6, 'width' => 250, 'height' => 140, 'text' => _ACCESSNUMBER, 'h_align' => "left", 'v_align' => "top" ));
        $chart['chart_value']      = array('color' => "ff0000", 'alpha' => 90, 'font' => "Times New Roman", 'bold' => true, 'size' => 18, 'position' => "cursor", 'prefix' => "", 'suffix' => "", 'decimals' => 0, 'separator' => "" );
		
        return $chart;
    }
    	
	function swf_createBarActiveUsers($lessonId, $from, $to){

	    $traffic = EfrontStats :: getUsersTime($lessonId, false, $from, $to);

        foreach ($traffic as $key => $value) {
            $times[] = ceil($value['total_seconds'] / 60);
        }
        $logins = array_keys($traffic);        
        array_unshift($logins, "");
        array_unshift($times, "");

        $chart['chart_data']       = array($logins, $times);
		$chart['chart_type']       = "bar";
		$chart['chart_rect']       = array('width' => "400", 'height' => "250"); 
		$chart['chart_transition'] = array('type'  => "scale"); 
		$chart['chart_value']      = array('color' => "ffffff", 'alpha' => 90, 'font' => "arial", 'bold' => true, 'size' => 14, 'position' => "cursor", 'prefix' => "", 'suffix' => "", 'decimals' => 2, 'separator' => "" );
		$chart['series_color']     = array("ff6600");
		$chart['legend_rect']      = array('x' => "-100", 'y' => "-100");		

		$chart['draw'] = array (array('type' => "text", 'color' => "ff0000", 'alpha' => 55, 'font' => "Times New Roman", 'rotation' => 0, 'bold' => true, 'size' => 30, 'x' => 25,  'y' => 11, 'width' => 500, 'height' => 240, 'text' => _5MOSTACTIVEUSERS, 'h_align' => "left",   'v_align' => "top" ),
                                array('type' => "text", 'color' => "000000", 'alpha' => 40, 'font' => "Times New Roman", 'rotation' => 0, 'bold' => true, 'size' => 15, 'x' => 100, 'y' => 75, 'width' => 400, 'height' => 290, 'text' => _MINUTES, 		   'h_align' => "center", 'v_align' => "bottom"));                           
		
		return $chart;										
	}    
	
    function swf_createLineAccessLesson($lessonId, $from, $to, $login) {
        $lesson = new EfrontLesson($lessonId);
        $traffic = EfrontStats :: getUsersTime($lessonId, false, $from, $to);

        $result = eF_getTableData("logs", "id, users_LOGIN, action, timestamp", "timestamp between $from and $to and lessons_id=".$lessonId." and users_LOGIN = '".$login."' order by timestamp");
        //Assign each day of the week an empty slot
        for ($i = $from; $i <= $to; $i = $i + 86400) {
            $times[date('Y/m/d', $i)] = 0;
        }
        //Assign the number of accesses to each week day
        foreach ($result as $value) {
            for ($i = $from; $i <= $to; $i = $i + 86400) {
                if ($i <= $value['timestamp'] && $value['timestamp'] < $i + 86400) {
                    $times[date('Y/m/d', $i)]++;
                }
            }
        }
        
        $chart['chart_type']       = "line";
        $chart['chart_rect']       = array('x' => 40, 'y' => 35, 'width' => 610, 'height' => 300);
		$chart['chart_transition'] = array('type' => "scale"); 
		$chart['series_color']     = array("0000ff");
		$chart['legend_rect']      = array('x' => "-100", 'y' => "-100");
		$chart['axis_category']    = array('size' => 14, 'color' => "000000", 'alpha' => 0, 'font' => "Times New Roman", 'bold' => true, 'skip' => 0 ,'orientation' => "horizontal" ); 
		$chart['axis_value' ]      = array('font' => "Times New Roman", 'bold' => true, 'size' => 14, 'color' => "000000", 'alpha' => 50, 'steps' => 6, 'prefix' => "", 'suffix' => "", 'decimals' => 0, 'separator' => "", 'show_min' => true );
		$chart['chart_data']       = array(array_keys($times), array_values($times));
		$chart['draw']             = array(array('type' => "text", 'color' => "0000ff", 'alpha' => 55, 'font' => "Times New Roman", 'rotation' => 0, 'bold' => true, 'size' => 25, 'x' => 95, 'y' => 6, 'width' => 550, 'height' => 140, 'text' => _USERACCESSESINLESSON, 'h_align' => "left", 'v_align' => "top"));
        $chart['chart_value']      = array('color' => "ff0000", 'alpha' => 90, 'font' => "Times New Roman", 'bold' => true, 'size' => 18, 'position' => "cursor", 'prefix' => "", 'suffix' => "", 'decimals' => 0, 'separator' => "" );
		return $chart;
    }	
    
    function swf_createLineUserLogin($from, $to, $login){
        $result = eF_getTableData("logs", "id, users_LOGIN, action, timestamp", "timestamp between $from and $to and action = 'login' and users_LOGIN = '".$login."' order by timestamp");

        //Assign each day of the week an empty slot
        for ($i = $from; $i <= $to; $i = $i + 86400) {
            $times[date('Y/m/d', $i)] = 0;
        }

        //Assign the number of accesses to each week day
        foreach ($result as $value) {
            for ($i = $from; $i <= $to; $i = $i + 86400) {
                if ($i <= $value['timestamp'] && $value['timestamp'] < $i + 86400) {
                    $times[date('Y/m/d', $i)]++;
                }
            }
        }
        
        $chart['chart_type']       = "line";
        $chart['chart_rect']       = array('x' => 40, 'y' => 35, 'width' => 610, 'height' => 300);
		$chart['chart_transition'] = array('type' => "scale"); 
		$chart['series_color']     = array("0000ff");
		$chart['legend_rect']      = array('x' => "-100", 'y' => "-100");
		$chart['axis_category']    = array('size' => 14, 'color' => "000000", 'alpha' => 0, 'font' => "Times New Roman", 'bold' => true, 'skip' => 0 ,'orientation' => "horizontal" ); 
		$chart['axis_value' ]      = array('font' => "Times New Roman", 'bold' => true, 'size' => 14, 'color' => "000000", 'alpha' => 50, 'steps' => 6, 'prefix' => "", 'suffix' => "", 'decimals' => 0, 'separator' => "", 'show_min' => true );
		$chart['chart_data']       = array(array_keys($times), array_values($times));
		$chart['draw']             = array(array('type' => "text", 'color' => "0000ff", 'alpha' => 55, 'font' => "Times New Roman", 'rotation' => 0, 'bold' => true, 'size' => 25, 'x' => 95, 'y' => 6, 'width' => 550, 'height' => 140, 'text' => _LOGINS, 'h_align' => "left", 'v_align' => "top"));
        $chart['chart_value']      = array('color' => "ff0000", 'alpha' => 90, 'font' => "Times New Roman", 'bold' => true, 'size' => 18, 'position' => "cursor", 'prefix' => "", 'suffix' => "", 'decimals' => 0, 'separator' => "" );
		return $chart;
        
    }
    
    function swf_createLineLoginTime($from, $to){
        $result = eF_getTableData("logs", "*", "timestamp between $from and $to and action = 'login' order by timestamp");

        //Assign each day of the week an empty slot
        for ($i = $from; $i <= $to; $i = $i + 86400) {
            $times[date('Y/m/d', $i)] = 0;
        }

        //Assign the number of accesses to each week day
        foreach ($result as $value) {
            for ($i = $from; $i <= $to; $i = $i + 86400) {
                if ($i <= $value['timestamp'] && $value['timestamp'] < $i + 86400) {
                    $times[date('Y/m/d', $i)]++;
                }
            }
        }
        
        $chart['chart_type']       = "line";
        $chart['chart_rect']       = array('x' => 40, 'y' => 35, 'width' => 610, 'height' => 300);
		$chart['chart_transition'] = array('type' => "scale"); 
		$chart['series_color']     = array("0000ff");
		$chart['legend_rect']      = array('x' => "-100", 'y' => "-100");
		$chart['axis_category']    = array('size' => 14, 'color' => "000000", 'alpha' => 0, 'font' => "Times New Roman", 'bold' => true, 'skip' => 0 ,'orientation' => "horizontal" ); 
		$chart['axis_value' ]      = array('font' => "Times New Roman", 'bold' => true, 'size' => 14, 'color' => "000000", 'alpha' => 50, 'steps' => 6, 'prefix' => "", 'suffix' => "", 'decimals' => 0, 'separator' => "", 'show_min' => true );
		$chart['chart_data']       = array(array_keys($times), array_values($times));
		$chart['draw']             = array(array('type' => "text", 'color' => "0000ff", 'alpha' => 55, 'font' => "Times New Roman", 'rotation' => 0, 'bold' => true, 'size' => 25, 'x' => 95, 'y' => 6, 'width' => 550, 'height' => 140, 'text' => _LOGINS, 'h_align' => "left", 'v_align' => "top"));
        $chart['chart_value']      = array('color' => "ff0000", 'alpha' => 90, 'font' => "Times New Roman", 'bold' => true, 'size' => 18, 'position' => "cursor", 'prefix' => "", 'suffix' => "", 'decimals' => 0, 'separator' => "" );
		return $chart;
    }
    
	function swf_createBarSystemActiveUsers($logins, $seconds) {
	    array_unshift($logins, "");	    
	    foreach ($seconds as $value) {
	        $minutes[] = ceil($value / 60);
	    }
	    array_unshift($minutes, "");	    

		$chart['chart_data']       = array($logins, $minutes);
		$chart['chart_type']       = "bar";
		$chart['chart_rect']       = array('width' => "400", 'height' => "250"); 
		$chart['chart_transition'] = array('type'  => "scale"); 
		$chart['chart_value']      = array('color' => "ffffff", 'alpha' => 90, 'font' => "arial", 'bold' => true, 'size' => 14, 'position' => "cursor", 'prefix' => "", 'suffix' => "", 'decimals' => 2, 'separator' => "" );
		$chart['series_color']     = array("ff6600");
		$chart['legend_rect']      = array('x' => "-100", 'y' => "-100");		

		$chart['draw'] = array (array('type' => "text", 'color' => "ff0000", 'alpha' => 55, 'font' => "Times New Roman", 'rotation' => 0, 'bold' => true, 'size' => 30, 'x' => 25,  'y' => 11, 'width' => 500, 'height' => 240, 'text' => _MOSTACTIVEUSERS, 'h_align' => "left",   'v_align' => "top" ),
                                array('type' => "text", 'color' => "000000", 'alpha' => 40, 'font' => "Times New Roman", 'rotation' => 0, 'bold' => true, 'size' => 15, 'x' => 100, 'y' => 75, 'width' => 400, 'height' => 290, 'text' => _MINUTES, 		   'h_align' => "center", 'v_align' => "bottom"));                           

		return $chart;							
	}
	
	function swf_createColumnUserTypes($lessonId = false) {
	    if ($lessonId) {
	        
	    } else {
	        $result = eF_getTableDataFlat("users", "user_type, count(user_type) as num", "", "", "user_type");
	        $userTypes = $result['user_type'];
	        $count     = $result['num'];
	    }
	    array_unshift($userTypes, "");
	    array_unshift($count, "");
	    
		$chart['chart_data']       = array($userTypes, $count);
		$chart['chart_type']       = "bar";
		$chart['chart_rect']       = array('width' => "400", 'height' => "250"); 
		$chart['chart_transition'] = array('type'  => "scale"); 
		$chart['chart_value']      = array('color' => "ffffff", 'alpha' => 90, 'font' => "arial", 'bold' => true, 'size' => 14, 'position' => "cursor", 'prefix' => "", 'suffix' => "", 'decimals' => 2, 'separator' => "" );
		$chart['series_color']     = array("ff6600");
		$chart['legend_rect']      = array('x' => "-100", 'y' => "-100");		

		$chart['draw'] = array (array('type' => "text", 'color' => "ff0000", 'alpha' => 55, 'font' => "Times New Roman", 'rotation' => 0, 'bold' => true, 'size' => 30, 'x' => 25,  'y' => 11, 'width' => 500, 'height' => 240, 'text' => _USERTYPE, 'h_align' => "left",   'v_align' => "top" ),
                                array('type' => "text", 'color' => "000000", 'alpha' => 40, 'font' => "Times New Roman", 'rotation' => 0, 'bold' => true, 'size' => 15, 'x' => 100, 'y' => 75, 'width' => 400, 'height' => 290, 'text' => _USERS,    'h_align' => "center", 'v_align' => "bottom"));                           

		return $chart;							
	    
	}
?>