<?php
//include charts.php to access the SendChartData function
include("config-and-functions.php");
include("charts.php");
if($_REQUEST['type'] == "exp")
{
$chart[ 'axis_category' ] = array ( 'size'=>11, 'color'=>"000000", 'alpha'=>100, 'font'=>"arial", 'bold'=>true, 'skip'=>1 ,'orientation'=>"diagonal_up" );
$chart[ 'axis_ticks' ] = array ( 'value_ticks'=>true, 'category_ticks'=>true );
$chart[ 'axis_value' ] = array ( 'alpha'=>90, 'orientation'=>"horizontal" );
$chart[ 'chart_border' ] = array ( 'top_thickness'=>0, 'bottom_thickness'=>3, 'left_thickness'=>3, 'right_thickness'=>0 );
$chart[ 'chart_grid_h' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 );
$chart[ 'chart_grid_v' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 );
$chart[ 'chart_rect' ] = array ( 'x'=>65, 'y'=>5, 'width'=>450, 'height'=>200, 'positive_alpha'=>20 );
$chart[ 'chart_pref' ] = array ( 'rotation_x'=>10, 'rotation_y'=>15 );
$chart[ 'chart_type' ] = "parallel 3d column" ;
$chart[ 'chart_value' ] = array ( 'color'=>"FFFF00", 'alpha'=>100, 'size'=>14, 'position'=>"cursor" );
$chart[ 'legend_label' ] = array ( 'layout'=>"horizontal", 'font'=>"arial", 'bold'=>true, 'size'=>12, 'color'=>"000000", 'alpha'=>90 );
$chart[ 'legend_rect' ] = array ( 'x'=>25, 'y'=>250, 'width'=>350, 'height'=>50, 'margin'=>20, 'fill_color'=>"000000", 'fill_alpha'=>7, 'line_color'=>"000000", 'line_alpha'=>0, 'line_thickness'=>0 );
$chart[ 'series_color' ] = array ("00FF00" );
$chart[ 'series_gap' ] = array ( 'bar_gap'=>50, 'set_gap'=>50) ;
$player = new OTS_Player();
$player->load($_REQUEST['guid']);
if($player->isLoaded())
{
$player_exp[0] = (int) $player->getExperience();
$player_exp[1] = (int) $player->getCustomField("exphist_lastexp");
$player_exp[2] = (int) $player_exp[1] - $player->getCustomField("exphist1");
$player_exp[3] = (int) $player_exp[2] - $player->getCustomField("exphist2");
$player_exp[4] = (int) $player_exp[3] - $player->getCustomField("exphist3");
$player_exp[5] = (int) $player_exp[4] - $player->getCustomField("exphist4");
$player_exp[6] = (int) $player_exp[5] - $player->getCustomField("exphist5");
$player_exp[7] = (int) $player_exp[6] - $player->getCustomField("exphist6");
$chart [ 'chart_data' ] = array ( array ( "", "7 Days ago", "","6 Days ago", "", "5 Days ago", "", "4 Days ago", "", "3 Days ago", "", "2 Days ago", "", "1 Days ago", "", "Today"),
array ( "Experience given each day", $player_exp[7],"",$player_exp[6], "",$player_exp[5], "",$player_exp[4], "",$player_exp[3], "", $player_exp[2], "", $player_exp[1], "", $player_exp[0]));
}
}
elseif($_REQUEST['type'] == "online")
{
$chart[ 'axis_category' ] = array ( 'size'=>11, 'color'=>"000000", 'alpha'=>100, 'font'=>"arial", 'bold'=>true, 'skip'=>1 ,'orientation'=>"diagonal_up" );
$chart[ 'axis_ticks' ] = array ( 'value_ticks'=>true, 'category_ticks'=>true );
$chart[ 'axis_value' ] = array ( 'alpha'=>90, 'orientation'=>"horizontal" );
$chart[ 'chart_border' ] = array ( 'top_thickness'=>0, 'bottom_thickness'=>3, 'left_thickness'=>3, 'right_thickness'=>0 );
$chart[ 'chart_grid_h' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 );
$chart[ 'chart_grid_v' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 );
$chart[ 'chart_rect' ] = array ( 'x'=>65, 'y'=>5, 'width'=>445, 'height'=>200, 'positive_alpha'=>20 );
$chart[ 'chart_pref' ] = array ( 'rotation_x'=>10, 'rotation_y'=>15 );
$chart[ 'chart_type' ] = "parallel 3d column" ;
$chart[ 'chart_value' ] = array ( 'color'=>"FF0000", 'alpha'=>100, 'size'=>14, 'position'=>"cursor" );
$chart[ 'legend_label' ] = array ( 'layout'=>"horizontal", 'font'=>"arial", 'bold'=>true, 'size'=>12, 'color'=>"000000", 'alpha'=>90 );
$chart[ 'legend_rect' ] = array ( 'x'=>25, 'y'=>250, 'width'=>350, 'height'=>50, 'margin'=>20, 'fill_color'=>"000000", 'fill_alpha'=>7, 'line_color'=>"000000", 'line_alpha'=>0, 'line_thickness'=>0 );
$chart[ 'series_color' ] = array ("FFFF00" );
$chart[ 'series_gap' ] = array ( 'bar_gap'=>50, 'set_gap'=>50) ;
$player = new OTS_Player();
$player->load($_REQUEST['guid']);
if($player->isLoaded())
{
$player_exp[0] = bcdiv($player->getCustomField("onlinetimetoday"), 3600, 2);
$player_exp[1] = bcdiv($player->getCustomField("onlinetime1"), 3600, 2);
$player_exp[2] = bcdiv($player->getCustomField("onlinetime2"), 3600, 2);
$player_exp[3] = bcdiv($player->getCustomField("onlinetime3"), 3600, 2);
$player_exp[4] = bcdiv($player->getCustomField("onlinetime4"), 3600, 2);
$player_exp[5] = bcdiv($player->getCustomField("onlinetime5"), 3600, 2);
$player_exp[6] = bcdiv($player->getCustomField("onlinetime6"), 3600, 2);
$player_exp[7] = bcdiv($player->getCustomField("onlinetime7"), 3600, 2);
$chart [ 'chart_data' ] = array ( array ( "", "7 Days ago", "","6 Days ago", "", "5 Days ago", "", "4 Days ago", "", "3 Days ago", "", "2 Days ago", "", "1 Days ago", "", "Today"),
array ( "Online time last days", $player_exp[7],"",$player_exp[6], "",$player_exp[5], "",$player_exp[4], "",$player_exp[3], "", $player_exp[2], "", $player_exp[1], "", $player_exp[0]));
}
}
elseif($_REQUEST['type'] == "expgain")
{
$chart[ 'axis_category' ] = array ( 'size'=>11, 'color'=>"000000", 'alpha'=>100, 'font'=>"arial", 'bold'=>true, 'skip'=>1 ,'orientation'=>"diagonal_up" );
$chart[ 'axis_ticks' ] = array ( 'value_ticks'=>true, 'category_ticks'=>true );
$chart[ 'axis_value' ] = array ( 'alpha'=>90, 'orientation'=>"horizontal" );
$chart[ 'chart_border' ] = array ( 'top_thickness'=>0, 'bottom_thickness'=>3, 'left_thickness'=>3, 'right_thickness'=>0 );
$chart[ 'chart_grid_h' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 );
$chart[ 'chart_grid_v' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 );
$chart[ 'chart_rect' ] = array ( 'x'=>65, 'y'=>5, 'width'=>445, 'height'=>200, 'positive_alpha'=>20 );
$chart[ 'chart_pref' ] = array ( 'rotation_x'=>10, 'rotation_y'=>15 );
$chart[ 'chart_type' ] = "parallel 3d column" ;
$chart[ 'chart_value' ] = array ( 'color'=>"00FF00", 'alpha'=>100, 'size'=>14, 'position'=>"cursor" );
$chart[ 'legend_label' ] = array ( 'layout'=>"horizontal", 'font'=>"arial", 'bold'=>true, 'size'=>12, 'color'=>"000000", 'alpha'=>90 );
$chart[ 'legend_rect' ] = array ( 'x'=>25, 'y'=>250, 'width'=>350, 'height'=>50, 'margin'=>20, 'fill_color'=>"000000", 'fill_alpha'=>7, 'line_color'=>"000000", 'line_alpha'=>0, 'line_thickness'=>0 );
$chart[ 'series_color' ] = array ("FF0000" );
$chart[ 'series_gap' ] = array ( 'bar_gap'=>50, 'set_gap'=>50) ;
$player = new OTS_Player();
$player->load($_REQUEST['guid']);
{
$player_exp[0] = (int) $player->getExperience() - $player->getCustomField("exphist_lastexp");
$player_exp[1] = (int) $player->getCustomField("exphist1");
$player_exp[2] = (int) $player->getCustomField("exphist2");
$player_exp[3] = (int) $player->getCustomField("exphist3");
$player_exp[4] = (int) $player->getCustomField("exphist4");
$player_exp[5] = (int) $player->getCustomField("exphist5");
$player_exp[6] = (int) $player->getCustomField("exphist6");
$player_exp[7] = (int) $player->getCustomField("exphist7");
$chart [ 'chart_data' ] = array ( array ( "", "7 Days ago", "","6 Days ago", "", "5 Days ago", "", "4 Days ago", "", "3 Days ago", "", "2 Days ago", "", "1 Days ago", "", "Today"),
array ( "Experience earned or lost last days", $player_exp[7],"",$player_exp[6], "",$player_exp[5], "",$player_exp[4], "",$player_exp[3], "", $player_exp[2], "", $player_exp[1], "", $player_exp[0]));
}
}
SendChartData ($chart);
?>