debug("Entering calculate_font_name(".$locale.") method ...");
switch($locale)
{
case 'zh_cn':
$log->debug("Exiting calculate_font_name method ...");
return FF_DROIDSANSFALLBACK;
case 'cn_zh':
$log->debug("Exiting calculate_font_name method ...");
return FF_DROIDSANSFALLBACK;
case 'tw_zh':
if(!function_exists('iconv')){
echo " Unable to display traditional Chinese on the graphs.
The function iconv does not exists please read more about iconv here
";
$log->debug("Exiting calculate_font_name method ...");
return FF_DEJAVUSAN;
}
else
{
$log->debug("Exiting calculate_font_name method ...");
return FF_CHINESE;
}
default:
$log->debug("Exiting calculate_font_name method ...");
return FF_DEJAVUSAN;
}
$log->debug("Exiting calculate_font_name method ...");
return FF_DEJAVUSAN;
}
/**This function is used to generate the n colors.
* Param $count - number of colors to generate
* Param $start - value of first color
* Param $step - color increment to apply
* Return type array - array of n colors values
*/
function color_generator($count = 1, $start = '33CCFF', $step = '221133')
{
global $log;
$log->debug("Entering color_generator(".$count.",".$start.",".$step.") method ...");
// explode color strings to RGB array
if($start{0} == "#") $start = substr($start,1);
if($step{0} == "#") $step = substr($step,1);
// pad shorter strings with 0
$start = substr($start."000000",0,6);
$step = substr($step."000000",0,6);
$colors = array(hexdec(substr($start,0,2)),hexdec(substr($start,2,2)),hexdec(substr($start,4,2)));
$steps = array(hexdec(substr($step,0,2)),hexdec(substr($step,2,2)),hexdec(substr($step,4,2)));
// buils $count colours adding $step to $start
$result = array();
for($i=1; $i<=$count; $i++){
array_push($result,"#".dechex($colors[0]).dechex($colors[1]).dechex($colors[2]));
for($j=0; $j<3; $j++) {
$colors[$j] += $steps[$j];
if($colors[$j] > 0xFF) $colors[$j] -= 0xFF;
}
}
$log->debug("Exiting color_generator method ...");
return $result;
}
/**This function is used to define the optimum spacin for tick marks on an axis
* Param $max - maximum value of axis
* Return type array - array of 2 values major and minor spacing
*/
function get_tickspacing($max = 10)
{
global $log,$app_strings;
$log->debug("Entering get_tickspacing(".$max.") method ...");
$result = array(1,1);
// normalize $max to get value between 1 and 10
$coef = pow(10,floor(log10($max)));
if($coef == 0)
{
$data=0;
echo "