Esempio n. 1
0
function pie_single_quarantine()
{
    $tpl = new Templates();
    $USER_QUARANTINE = $_GET["USER_QUARANTINE"];
    $SAFE = $_GET["SAFE"];
    $title = $tpl->_ENGINE_parse_body("{quarantines_graph}");
    $date = date('Y-m-d');
    $textes = array();
    $donnees = array();
    $zlabel = array();
    $date = date('Y-m-d');
    $textes[] = 'title';
    $donnees[] = '';
    $donnees[] = $SAFE;
    $textes[] = "Sended";
    $donnees[] = $USER_QUARANTINE;
    $textes[] = "Quarantine";
    $chart['axis_value'] = array('bold' => false, 'size' => 8);
    $chart['axis_category'] = array('skip' => 1, 'font' => "Tahoma", 'bold' => true, 'size' => 8, 'color' => "000000", 'alpha' => 75, 'orientation' => "horizontal");
    $chart['legend_label'] = array('layout' => 'vertical', 'bullet' => 'square', 'font' => 'Arial', 'bold' => true, 'size' => 11, 'color' => "000000", 'alpha' => 90);
    $chart['chart_type'] = "3d pie";
    $chart['chart_pref'] = array('line_thickness' => 2, 'point_shape' => "none", 'fill_shape' => true);
    $chart['chart_data'] = array($textes, $donnees);
    //$chart [ 'live_update' ] =  array ( 'url'=>"statistiques-generator.php?articles-jour=yes", 'delay'=>30 );
    $chart['series_color'] = array('005447', '009D86', 'ddaa41', 'A4781E', '88dd11', '634812', '4e62dd', 'ff8811', '4d4d4d', '5a4b6e', 'C60000', 'FF3333', 'FF0099', 'DFDF00');
    $chart["series_explode"] = array(10, 10, 10);
    $chart["chart_value"] = array('color' => 'ffffff', 'alpha' => '90', 'font' => 'arial', 'bold' => 'true', 'size' => '10', 'position' => 'inside', 'prefix' => '', 'suffix' => '', 'decimals' => '0', 'separator' => '');
    $chart["legend_label"] = array('layout' => 'vertical', 'bullet' => 'circle', 'font' => 'arial', 'bold' => 'true', 'size' => '11', 'color' => '005447', 'alpha' => '85');
    $chart['chart_transition'] = array('type' => 'dissolve', 'delay' => 0, 'duration' => 0.5, 'order' => 'all');
    SendChartData($chart);
}
function showChart($chart, $chartWidth, $chartHeight)
{
    $database = DB::getInstance();
    $db = $database->getConnection();
    $reg_key = "C1XUW9CU8Y4L.NS5T4Q79KLYCK07EK";
    $chart_xml = SendChartData($chart);
    $mysql['chart_xml'] = $db->real_escape_string($chart_xml);
    $chart_sql = "INSERT INTO 202_charts SET chart_xml='" . $mysql['chart_xml'] . "'";
    $chart_result = _mysqli_query($chart_sql);
    //($chart_sql);
    $chart_id = $db->insert_id;
    $url['chart_id'] = urlencode($chart_id);
    if (!isset($_COOKIE['hideChartUpgrade'])) {
        echo '<div class="modal fade" id="chartsUpgradeModal" tabindex="-1" role="dialog" aria-labelledby="chartsUpgradeModalLabel" aria-hidden="true">
				<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
		        		<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        		<h4 class="modal-title" id="chartsUpgradeModalLabel">NEW HTML5 charts</h4>
		      		</div>
		      		<div class="modal-body">
		        		<img src="/202-img/chart.png" style="width: 100%;">
		      		</div>
		      		<div class="modal-footer">
		        		<a href="http://click202.com/tracking202/redirect/dl.php?t202id=8151295&t202kw=graph" target="_blank" class="btn btn-p202">This is a Prosper202 Pro Feature: Upgrade Now To Access!</a>
		      		</div>
		    	</div>
				</div>
		</div>';
        echo '<script>$("#chartsUpgradeModal").modal();</script>';
    }
    echo InsertChart('/202-charts/charts.swf', '/202-charts/charts_library', '/202-charts/showChart.php?chart_id=' . $url['chart_id'], $chartWidth, $chartHeight, 'FFFFFF', false, $reg_key);
}
Esempio n. 3
0
<?php

include dirname(__FILE__) . "/../lib/charts/charts.php";
$chart['chart_type'] = $_GET['display'];
$chart['live_update'] = array('url' => str_replace('update.php', $_GET['chart'] . '.php', $_SERVER['REQUEST_URI']));
SendChartData($chart);
 /**
  * Calls the Chart, SendChartData() function and exits    
  */
 protected function SendChartData()
 {
     $err = array();
     while (ob_get_length() !== false) {
         if (!($out = ob_get_clean())) {
             continue;
         }
         $err[] = $out;
     }
     if (count($err) > 0) {
         I2CE::raiseError("Suppresed error(s) while generating flash:\n" . implode("\n", $err));
     }
     SendChartData($this->chart);
     exit;
 }
Esempio n. 5
0
function showCategoryData()
{
    global $badgerDb;
    global $logger;
    $logger->log('showCategoryData: REQUEST_URI: ' . $_SERVER['REQUEST_URI']);
    if (!isset($_GET['accounts']) || !isset($_GET['startDate']) || !isset($_GET['endDate']) || !isset($_GET['type']) || !isset($_GET['summarize'])) {
        throw new BadgerException('statistics', 'missingParameter');
    }
    $accounts = explode(';', $_GET['accounts']);
    foreach ($accounts as $key => $val) {
        settype($accounts[$key], 'integer');
    }
    $startDate = new Date($_GET['startDate']);
    $endDate = new Date($_GET['endDate']);
    $type = $_GET['type'];
    if ($type !== 'o') {
        $type = 'i';
    }
    if ($_GET['summarize'] !== 't') {
        $summarize = false;
    } else {
        $summarize = true;
    }
    $categories = gatherCategories($accounts, $startDate, $endDate, $type, $summarize);
    $sum = new Amount();
    foreach ($categories as $currentCategory) {
        $sum->add($currentCategory['amount']);
    }
    $chart = array();
    //for documentation for the following code see: http://www.maani.us/charts/index.php?menu=Reference
    $chart['chart_type'] = '3d pie';
    $chart['axis_category'] = array('skip' => 0, 'font' => "Arial", 'bold' => false, 'size' => 10, 'color' => "000000", 'alpha' => 100, 'orientation' => "horizontal");
    $chart['chart_rect'] = array('x' => 150, 'y' => 50, 'width' => 500, 'height' => 250, 'positive_color' => "ffffff", 'negative_color' => "000000", 'positive_alpha' => 0, 'negative_alpha' => 0);
    $chart['chart_value'] = array('prefix' => "", 'suffix' => "", 'decimals' => 0, 'decimal_char' => ".", 'separator' => "", 'position' => "outside", 'hide_zero' => true, 'as_percentage' => false, 'font' => "Arial", 'bold' => false, 'size' => 10, 'color' => "000000", 'alpha' => 90);
    $chart['chart_transition'] = array('type' => "none", 'delay' => 1, 'duration' => 1, 'order' => "all");
    $chart['legend_rect'] = array('x' => 700, 'y' => 400, 'width' => 0, 'height' => 0, 'margin' => 5, 'fill_color' => "FFFFFF", 'fill_alpha' => 100, 'line_color' => "000000", 'line_alpha' => 100, 'line_thickness' => 1);
    $chart['legend_label'] = array('layout' => "vertical", 'bullet' => "circle", 'font' => "Arial", 'bold' => false, 'size' => 11, 'color' => "000000", 'alpha' => 90);
    $chart['legend_transition'] = array('type' => "none", 'delay' => 1, 'duration' => 1);
    $chart['series_color'] = array('000070', 'FFFF99', '007000', 'FFCC99', '700070', 'CC99FF', '660000', '9999FF', '006666', 'CCFF99', 'A35200', 'FFCA7A');
    $chart['chart_data'] = array();
    $chart['chart_value_text'] = array();
    $chart['chart_data'][0][0] = '';
    $chart['chart_data'][1][0] = '';
    $chart['chart_value_text'][0][0] = '';
    $chart['chart_value_text'][1][0] = '';
    foreach ($categories as $key => $val) {
        $chart['chart_data'][0][] = utf8_encode($val['title']);
        $chart['chart_value_text'][0][] = null;
        if ($type == 'i') {
            $chart['chart_data'][1][] = $val['amount']->get();
        } else {
            $chart['chart_data'][1][] = $val['amount']->mul(-1)->get();
        }
        $chart['chart_value_text'][1][] = utf8_encode($val['title'] . "\n" . $val['amount']->getFormatted() . "\n" . round($val['amount']->div($sum)->mul($type == 'i' ? 100 : -100)->get(), 2) . ' %');
    }
    SendChartData($chart);
}
<?php

//include charts.php to access the SendChartData function
require_once BADGER_ROOT . "/includes/charts/charts.php";
SendChartData();
<?php

define("BADGER_ROOT", "../..");
//include charts.php to access the SendChartData function
require_once BADGER_ROOT . "/includes/charts/charts.php";
//change the chart to a bar chart
$linechart['chart_type'] = "line";
SendChartData($linechart);
Esempio n. 8
0
 /**
  * Process
  * Does all of the work. Includes the chart, works out the data, prints it out.
  *
  * @return void
  */
 function Process()
 {
     $session =& GetSession();
     $thisuser = $session->Get('UserDetails');
     $this->CalculateCalendarRestrictions();
     $this->GetSearchUser();
     $ignoreips = $this->GetIgnoreDetails();
     $ignorereferrers = $this->GetIgnoreDetails('Referrers');
     $ignorekeywords = $this->GetIgnoreDetails('Keywords');
     // http://www.maani.us/charts/index.php?menu=Reference&submenu=chart_value
     include dirname(__FILE__) . '/charts/charts.php';
     $chart['chart_type'] = 'column';
     $chart['series_switch'] = true;
     //hide the legend
     $chart['legend_rect'] = array('x' => -1000, 'y' => -1000);
     $chart['chart_data'] = array();
     $chart['chart_data'][0][0] = '';
     $graph_choice = $thisuser->GetSettings('GraphChoice');
     // since getsettings returns an array by default, we have to check for it.
     // if it's an array or if it's empty, then we'll set it to the default (revenue).
     // this will get set properly if/when the choice is changed.
     if (is_array($graph_choice) || !$graph_choice) {
         $graph_choice = '';
     }
     switch (strtolower($graph_choice)) {
         case 'visits':
             $prefix = '';
             $chart_title = GetLang('Chart_Title_Visits');
             $chart_value = $graph_choice;
             $chart_data = GetLang(ucwords($chart_value));
             break;
         case 'conversions':
             $prefix = '';
             $chart_title = GetLang('Chart_Title_Conversions');
             $chart_value = $graph_choice;
             $chart_data = GetLang(ucwords($chart_value));
             break;
         default:
             $prefix = GetLang('CurrencySymbol');
             $chart_title = GetLang('Chart_Title') . " (" . GetLang('CurrencySymbol') . ")";
             $chart_value = 'revenue';
             $chart_data = GetLang(ucwords($chart_value));
             break;
     }
     $count = 1;
     foreach ($this->ExportTypes as $p => $type) {
         $chart['chart_data'][0][] = GetLang($type);
         $chart['chart_data'][1][] = $chart_data;
         if ($type == 'campaign' || $type == 'ppc') {
             $qry = "SELECT COUNT(" . $this->ExportDbInfo[$type]['key'] . ") AS visits, SUM(amount) AS revenue, SUM(hasconversion) AS conversions, SUM(cost) AS cost, (SUM(amount) / SUM(cost)*100) AS roi FROM " . TRACKPOINT_TABLEPREFIX . $this->ExportDbInfo[$type]['table'] . " WHERE " . $this->SearchUserID . ($this->CalendarRestrictions ? ' AND ' . $this->CalendarRestrictions : '');
             if ($ignoreips) {
                 $qry .= " AND " . $ignoreips;
             }
         } else {
             $qry = "SELECT COUNT(" . $this->ExportDbInfo[$type]['key'] . ") AS visits, SUM(amount) AS revenue, SUM(hasconversion) AS conversions FROM " . TRACKPOINT_TABLEPREFIX . $this->ExportDbInfo[$type]['table'] . " WHERE " . $this->SearchUserID . ($this->CalendarRestrictions ? ' AND ' . $this->CalendarRestrictions : '');
             if ($ignoreips) {
                 $qry .= " AND " . $ignoreips;
             }
             if ($type == 'referrer') {
                 if ($ignorereferrers) {
                     $qry .= " AND " . $ignorereferrers;
                 }
             }
             if ($type == 'search') {
                 if ($ignorekeywords) {
                     $qry .= " AND " . $ignorekeywords;
                 }
             }
         }
         $result = $this->Db->Query($qry);
         $row = $this->Db->Fetch($result);
         $chart['chart_data'][1][$count] = $row[$chart_value];
         $chart['chart_value_text'][2][$count] = $this->FormatNumber($row[$chart_value], 2);
         $count++;
     }
     $chart['chart_value'] = array('prefix' => $prefix, 'decimals' => 2, 'decimal_char' => GetLang('NumberFormat_Dec'), 'separator' => GetLang('NumberFormat_Thousands'), 'color' => 'FFFFFF', 'bold' => false, 'position' => 'inside', 'hide_zero' => true);
     $chart['chart_bg'] = array('positive_color' => "000000", 'positive_alpha' => 0, 'negative_color' => "FFFFFF", 'negative_alpha' => 0);
     $chart['chart_grid_h'] = array('thickness' => 1);
     $chart['chart_grid_v'] = array('thickness' => 1);
     $chart['draw_text'] = array(array('x' => 0, 'y' => 0, 'width' => 400, 'height' => 40, 'h_align' => 'center', 'v_align' => 'top', 'text' => $chart_title, 'color' => '000000', 'size' => 11, 'alpha' => 100));
     $chart['series_color'] = array("E74D00", "FFBE21", "84B221", "6379AD");
     SendChartData($chart);
 }
function showChart($chart, $chartWidth, $chartHeight)
{
    $reg_key = "C1XUW9CU8Y4L.NS5T4Q79KLYCK07EK";
    $chart_xml = SendChartData($chart);
    $mysql['chart_xml'] = mysql_real_escape_string($chart_xml);
    $chart_sql = "INSERT INTO 202_charts SET chart_xml='" . $mysql['chart_xml'] . "'";
    $chart_result = _mysql_query($chart_sql);
    //($chart_sql);
    $chart_id = mysql_insert_id();
    $url['chart_id'] = urlencode($chart_id);
    echo InsertChart('/xtracks-charts/charts.swf', '/xtracks-charts/charts_library', '/xtracks-charts/showChart.php?chart_id=' . $url['chart_id'], $chartWidth, $chartHeight, 'FFFFFF', false, $reg_key);
}
Esempio n. 10
0
	/**
	* Process
	* Does all of the work. Includes the chart, works out the data, prints it out.
	* It works out the type of calendar you're viewing (monthly, daily, weekly etc) and sets appropriate variables.
	* The stats api works out what type of calendar it is. It is done there so the stats file can make use of it as well for displaying date/time information.
	*
	* @see calendar_type
	* @see daily_stats_type
	* @see stats_type
	* @see chart_details
	* @see SetupChartDates
	* @see SetupChart_Subscribers
	* @see SetupChart
	* @see Stats_API::GetSubscriberGraphData
	* @see Stats_API::GetGraphData
	* @see Stats_API::CalculateStatsType
	* @see chart
	*
	* @return Void Prints out the chard, doesn't return anything.
	*/
	function Process()
	{
		$thisuser = IEM::getCurrentUser();

		$this->LoadLanguageFile('Stats');

		$idx = false;
		if (isset($_GET['i']) && $_GET['i'] == 1) {
			$idx = true;
		}
		$this->stats_api->CalculateStatsType($idx);

		$calendar_dates = $thisuser->GetSettings('CalendarDates');

		include(dirname(__FILE__) . '/amcharts/amcharts.php');

		$statid = 0;
		if (isset($_GET['statid'])) {
			$statid = (int)$_GET['statid'];
		}

		$chart_area = false;
		if (isset($_GET['Area'])) {
			$chart_area = strtolower($_GET['Area']);
		}

		switch ($chart_area) {
			case 'autoresponder':
			case 'list':
			case 'subscriberdomains':
				$chart_area = ucwords($chart_area);
			break;

			default:
				$chart_area = 'Newsletter';
		}

		$chart_type = false;
		if (isset($_GET['graph'])) {
			$chart_type = strtolower($_GET['graph']);
		}

		$list_statistics = IEM::sessionGet('ListStatistics');

		if ($list_statistics) {
			$statid = $list_statistics;
		}

		switch ($chart_type) {
			case 'bouncechart':
				$restrictions = isset($calendar_dates['bounces']) ? $calendar_dates['bounces'] : '';
				$this->chart['chart_data'][1][0] = GetLang('Stats_TotalBouncedEmails');

				$this->chart['chart_type'] = 'column';
				$this->chart['chart_data'][1][0] = GetLang('SoftBounces');
				$this->chart['chart_data'][2][0] = GetLang('HardBounces');
			break;

			case 'userchart':
				$restrictions = $calendar_dates['usersummary'];
				$this->chart['chart_data'][1][0] = GetLang('Stats_TotalEmailsSent');
			break;

			case 'openchart':
				$restrictions = IEM::ifsetor($calendar_dates['opens'], '');
				$this->chart['chart_data'][1][0] = GetLang('Stats_TotalOpens');
			break;

			case 'forwardschart':
				$restrictions = IEM::ifsetor($calendar_dates['forwards'], '');
				$this->chart['chart_data'][1][0] = GetLang('Stats_TotalForwards');
			break;

			case 'unsubscribechart':
				$restrictions = IEM::ifsetor($calendar_dates['unsubscribes'], '');
				$this->chart['chart_data'][1][0] = GetLang('Stats_TotalUnsubscribes');
			break;

			case 'linkschart':
				$restrictions = IEM::ifsetor($calendar_dates['clicks'], '');
				$this->chart['chart_data'][1][0] = GetLang('Stats_TotalClicks');
			break;

			case 'subscribersummary':
				$restrictions = IEM::ifsetor($calendar_dates['subscribers'], '');

				$this->chart['chart_type'] = 'column';
				$this->chart['chart_data'][1][0] = GetLang('Unconfirms');
				$this->chart['chart_data'][2][0] = GetLang('Confirms');
				$this->chart['chart_data'][3][0] = GetLang('Unsubscribes');
				$this->chart['chart_data'][4][0] = GetLang('Bounces');
				$this->chart['chart_data'][5][0] = GetLang('Forwards');

				$list = 0;
				if (isset($_GET['list'])) {
					$list = (int)$_GET['list'];
				}
			break;

			// use 'custom_pie' chart type to send data to the plotting software and produce a pie chart
			case 'custom_pie':
				// expects a data string in the format "john:123,paul:101,george:153,ringo:139"
				$chart_type = false;
				$chart_data = array();
				$this->chart['chart_type'] = 'pie';
				$data = explode(",", $this->_getGETRequest('data', ''));

				for ($i = 0; $i < count($data); $i++ ) {
					$values = explode(":", $data[$i]);
					$this->chart['chart_data'][0][$i+1] = $values[0];
					$this->chart['chart_data'][1][$i+1] = $values[1];
				}

				$this->chart['chart_value_text'][1][1] = 7;
				$this->chart['chart_value_text'][1][2] = 8;
				$this->chart['chart_value_text'][1][3] = 9;

			break;

			// use 'custom_bar' chart type to send data to the plotting software and produce a bar chart
			// expects following url parameters :
			// data=john:56:23:9,paul:32:9:1,george:98:43:12 & xLabels=albums,eps,singles
			case 'custom_bar':
				$xLabels = explode(',', $this->_getGETRequest('xLabels', ''));
				$data = explode(",", $this->_getGETRequest('data', ''));
				$chart_type = false;
				$this->chart['chart_type'] = 'column';

				$chart_data = array();
				$xAxisLabels = array();
				$xAxisLabels[0] = '';

				// Add the X Axis Elements
				for ($i = 0; $i < count($xLabels); $i++ ) {
					$xAxisLabels[] = $xLabels[$i];
				}
				$chart_data[] = $xAxisLabels;

				// Add the data and legend information
				// the first item in each xData array is the legend text the remainder are data value elements
				for ($i = 0; $i < count($data); $i++ ) {
					$xData = array();
					$values = explode(":", $data[$i]);
					for ($j = 0; $j < count($values); $j++) {
						$xData[] = $values[$j];
					}
					$chart_data[] = $xData;
				}

				$this->chart['chart_data'] = $chart_data;
				$this->chart['axis_category'] = array('skip' => 0);

			break;

			default:
				// this is for the "summary" pages where it breaks down opens/unopened/bounces
				// the summary pages are all pie charts.
				$chart_type = false;

				$this->chart['chart_type'] = 'pie';

				if (strtolower($chart_area) == 'subscriberdomains') {
					$chart_title = GetLang('ListStatistics_Snapshot_PerDomain');
					$domain_details = IEM::sessionGet('SubscriberDomains');

					$total = array_sum($domain_details);

					$graph_pos = 1;

					if ($total == 0) {
						$this->chart['chart_type'] = 'column';
					} else {
						foreach ($domain_details as $domain_name => $count) {
							$percent = 0;
							if ($total > 0) {
								$percent = $this->FormatNumber(($count / $total) * 100);
							}

							$this->chart['chart_data'][0][$graph_pos] = sprintf(GetLang('Summary_Domain_Name'), $domain_name, $percent);

							$this->chart['chart_data'][1][$graph_pos] = $count;

							$this->chart['chart_value_text'][1][$graph_pos] = $this->FormatNumber($count);

							$graph_pos++;
						}
					}

					break;
				}

				$opens = $unopened = $bounces = 0;

				if (isset($_GET['Opens'])) {
					$opens = (int)$_GET['Opens'];
				}

				if (isset($_GET['Unopened'])) {
					$unopened = (int)$_GET['Unopened'];
				}

				if (isset($_GET['Bounced'])) {
					$bounces = (int)$_GET['Bounced'];
				}

				if (isset($_GET['Heading']) && $_GET['Heading'] == 'User') {
					$chart_title = GetLang('User_Summary_Graph');
				} else {
					$chart_title = GetLang($chart_area . '_Summary_Graph');
				}

				if ($opens == 0 && $bounces == 0 && $unopened == 0) {
					$unopened = 1;
				}

				$total = $opens + $unopened + $bounces;

				$opens_percent = $unopened_percent = $bounces_percent = 0;

				if ($total > 0) {
					$opens_percent = $this->FormatNumber(($opens / $total) * 100);
					$unopened_percent = $this->FormatNumber(($unopened / $total) * 100);
					$bounces_percent = $this->FormatNumber(($bounces / $total) * 100);
				}

				$this->chart['chart_data'][0][1] = sprintf(GetLang('Summary_Graph_Opened'), $opens_percent);
				$this->chart['chart_data'][0][2] = sprintf(GetLang('Summary_Graph_Unopened'), $unopened_percent);
				$this->chart['chart_data'][0][3] = sprintf(GetLang('Summary_Graph_Bounced'), $bounces_percent);

				$this->chart['chart_data'][1][1] = $opens;
				$this->chart['chart_data'][1][2] = $unopened;
				$this->chart['chart_data'][1][3] = $bounces;

				if ($opens == 0 && $unopened == 0 && $bounces == 0) {
					$this->chart['chart_type'] = 'column';
				}

				$opens_percent = $opens / 100;

				$this->chart['chart_value_text'][1][1] = $this->FormatNumber($opens);
				$this->chart['chart_value_text'][1][2] = $this->FormatNumber($unopened);
				$this->chart['chart_value_text'][1][3] = $this->FormatNumber($bounces);

		}

		if ($chart_type) {
			$chart_title = GetLang($chart_area . '_Summary_Graph_' . $chart_type);

			$this->SetupChartDates($chart_type);
			$listid = 0;
			if (isset($_GET['Area']) && $_GET['Area'] == 'list' && isset($_GET['statid'])) {
				$listid = (int)$_GET['statid'];
			}
			if (isset($_GET['List'])) {
				$listid = (int)$_GET['List'];
			}

			switch ($chart_type) {
				case 'bouncechart':
					$data = $this->stats_api->GetBounceGraphData($this->stats_api->stats_type, $restrictions, $statid, $listid);
					$this->SetupChart_BounceSummary($data);
				break;

				case 'subscribersummary':
					if (isset($_GET['i']) && $_GET['i'] == 1) {
						$data = IEM::sessionGet('IndexSubscriberGraphData');
					} else {
						$data = IEM::sessionGet('SubscriberGraphData');
					}

					$this->SetupChart_SubscriberSummary($data);
				break;

				case 'userchart':
					$data = IEM::sessionGet('userchart_data');
					$this->SetupChart($data);
				break;

				default:
					$data = $this->stats_api->GetGraphData($statid, $this->stats_api->stats_type, $restrictions, $chart_type, $listid);
					$this->SetupChart($data);
				break;
			}
		}

		// Prints the chart as a gif or png
		if (isset($_GET['GetAsImg'])) {
			// graphpite causes lots of notices and warning, so turn those off
			error_reporting(E_PARSE | E_ERROR);

			// Turn off error handling, it breaks the chart generation
			set_error_handler('ord');

			require_once(dirname(__FILE__) . "/amcharts/graphpite.php");
			// Width & height are fixed at 650x300 for printing
			$chart_image = new Chart_Image(650,300,$chart_title);
			$chart_image->Generate($this->chart);
			$chart_image->PrintImage();

			// Restore error handling
			error_reporting(E_ALL);
			restore_error_handler();
		} else {
			// gets chart data as xml for amcharts
			SendChartData($this->chart);
		}
	}