Ejemplo n.º 1
0
if (($handle = fopen($csvfile, "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) {
        $num = count($data);
        $row++;
        for ($c = 0; $c < $num; $c++) {
            if ($c % 2) {
                array_push($Numberofsearches, $data[$c]);
            } else {
                array_push($OrgDetails, $data[$c]);
            }
        }
    }
}
//print_r( $OrgDetails);
//print_r ($Numberofsearches);
require_once "/var/www/ChartDirector/lib/phpchartdir.php";
# Create a Bar object of size 360 x 300 pixels
$c = new XYChart(810, 390);
$c->addTitle($display_date . ' / ' . $display_org_type . ' / ' . $display_geo);
# Set the plotarea at (30, 20) and of size 200 x 200 pixels
$c->setPlotArea(40, 10, 640, 280, 0xe9fae7, 0xffffff);
$barLayerObj = $c->addBarLayer($Numberofsearches, 0x8fc28a);
$barLayerObj->set3D();
$barLayerObj->setBarShape(CircleShape);
# Set the labels on the x axis.
$c->xAxis->setLabels($OrgDetails);
$c->xAxis->setLabelStyle("Arial", 8, TextColor, 30);
# Add a title to the y axis
$c->yAxis->setTitle("Searches");
$filename = $path . "/provider/charts/defaultimages/" . $imagename;
$c->makeChart($filename);
Ejemplo n.º 2
0
                array_push($count, $data[$c]);
            } else {
                array_push($matchdate, $data[$c]);
            }
        }
    }
    fclose($handle);
}
array_shift($count);
array_shift($matchdate);
//  echo "matchdate";
//       print_r($matchdate);
//      print_r($count);
require_once "/var/www/ChartDirector/lib/phpchartdir.php";
# Create a XYChart object of size 250 x 250 pixels
$c = new XYChart(780, 390);
# Set the plotarea at (30, 20) and of size 200 x 200 pixels
$c->setPlotArea(40, 10, 700, 290, 0xe9fae7, 0xffffff);
# Add a title to the pie chart
$c->addTitle($display_date);
# Add a line chart layer using the given data
$lineObj = $c->addLineLayer($count, 0x70e17513);
$lineObj->set3D();
$c->yAxis->setTickDensity(30);
$c->xAxis->setTickDensity(75);
# Set the labels on the x axis.
$c->xAxis->setLabels($matchdate);
# Add a title to the y axis
$c->yAxis->setTitle("Searches");
# Add a title to the x axis
$c->xAxis->setTitle("Days");
Ejemplo n.º 3
0
 function addIndicator($height)
 {
     #create a new chart object
     $ret = new XYChart($this->m_totalWidth, $height + $this->m_topMargin + $this->m_bottomMargin, Transparent);
     $ret->setTrimData($this->m_extraPoints);
     if ($this->m_currentChart != null) {
         #if there is a chart before the newly created chart, disable its x-axis, and copy
         #its x-axis labels to the new chart
         $this->m_currentChart->xAxis->setColors(Transparent, Transparent);
         $ret->xAxis->copyAxis($this->m_currentChart->xAxis);
         #add chart to MultiChart and update the total height
         $this->addChart(0, $this->m_totalHeight + $this->m_plotAreaGap, $ret);
         $this->m_totalHeight = $this->m_totalHeight + $height + 1 + $this->m_plotAreaGap;
     } else {
         #no existing chart - create the x-axis labels from scratch
         $this->setXLabels($ret->xAxis);
         #add chart to MultiChart and update the total height
         $this->addChart(0, $this->m_totalHeight, $ret);
         $this->m_totalHeight = $this->m_totalHeight + $height + 1;
     }
     #the newly created chart becomes the current chart
     $this->m_currentChart = $ret;
     #update the size
     $this->setSize($this->m_totalWidth, $this->m_totalHeight + $this->m_topMargin + $this->m_bottomMargin);
     #configure the plot area
     $plotAreaObj = $ret->setPlotArea($this->m_leftMargin, $this->m_topMargin, $this->m_totalWidth - $this->m_leftMargin - $this->m_rightMargin, $height, $this->m_plotAreaBgColor, -1, $this->m_plotAreaBorder);
     $plotAreaObj->setGridColor($this->m_majorHGridColor, $this->m_majorVGridColor, $this->m_minorHGridColor, $this->m_minorVGridColor);
     $ret->setAntiAlias($this->m_antiAlias);
     #configure legend box
     $box = $ret->addLegend($this->m_leftMargin, $this->m_topMargin, false, $this->m_legendFont, $this->m_legendFontSize);
     $box->setFontColor($this->m_legendFontColor);
     $box->setBackground($this->m_legendBgColor);
     $box->setMargin2(5, 0, 2, 1);
     $box->setSize($this->m_totalWidth - $this->m_leftMargin - $this->m_rightMargin + 1, 0);
     #configure x-axis
     $a = $ret->xAxis;
     $a->setIndent(true);
     $a->setTickLength(2, 0);
     $a->setColors(Transparent, $this->m_xAxisFontColor, $this->m_xAxisFontColor, $this->m_xAxisFontColor);
     $a->setLabelStyle($this->m_xAxisFont, $this->m_xAxisFontSize, $this->m_xAxisFontColor, $this->m_xAxisFontAngle);
     #configure y-axis
     $ret->setYAxisOnRight($this->m_axisOnRight);
     $this->configureYAxis($ret->yAxis, $height);
     return $ret;
 }
Ejemplo n.º 4
0
<?php

include "../html/trader-functions.php";
require_once "../ChartDirector/lib/phpchartdir.php";
global $db_hostname, $db_database, $db_user, $db_password;
redirect_login_pf();
$username = $_SESSION['username'];
$uid = $_SESSION['uid'];
// make sure they're logged in"
if (isset($username)) {
    $c = new XYChart(640, 480);
    $portfolio = new portfolio($_SESSION['pfid']);
    $pf_id = $portfolio->getID();
    $pf_name = $portfolio->getName();
    $pf_working_date = $portfolio->getWorkingDate();
    $pf_exch = $portfolio->getExch()->getID();
    $symb = $_GET['symb'];
    $symb_name = get_symb_name($symb, $pf_exch);
    $endDate = chartTime2(strtotime($pf_working_date));
    if (isset($_SESSION['chart_period'])) {
        $chart_period = $_SESSION['chart_period'];
    } else {
        $chart_period = 180;
    }
    $durationInDays = (int) $chart_period;
    $startDate = $endDate - $durationInDays * 24 * 60 * 60;
    $first_date = $c->formatValue($startDate, "{value|yyyy-mm-dd}");
    $first = true;
    try {
        $pdo = new PDO("pgsql:host={$db_hostname};dbname={$db_database}", $db_user, $db_password);
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Ejemplo n.º 5
0
<?php

include "../html/trader-functions.php";
require_once "../ChartDirector/lib/phpchartdir.php";
global $db_hostname, $db_database, $db_user, $db_password;
redirect_login_pf();
$username = $_SESSION['username'];
$uid = $_SESSION['uid'];
// make sure they're logged in"
if (isset($username)) {
    $c = new XYChart(640, 180);
    $portfolio = new portfolio($_SESSION['pfid']);
    $pf_id = $portfolio->getID();
    $pf_name = $portfolio->getName();
    $pf_working_date = $portfolio->getWorkingDate();
    $pf_exch = $portfolio->getExch()->getID();
    $symb = $_GET['symb'];
    $symb_name = get_symb_name($symb, $pf_exch);
    $endDate = chartTime2(strtotime($pf_working_date));
    if (isset($_SESSION['chart_period'])) {
        $chart_period = $_SESSION['chart_period'];
    } else {
        $chart_period = 180;
    }
    $durationInDays = (int) $chart_period;
    $startDate = $endDate - $durationInDays * 24 * 60 * 60;
    $first_date = $c->formatValue($startDate, "{value|yyyy-mm-dd}");
    $first = true;
    try {
        $pdo = new PDO("pgsql:host={$db_hostname};dbname={$db_database}", $db_user, $db_password);
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Ejemplo n.º 6
0
 #$query = "select date, cash_in_hand, holdings from (select date, cash_in_hand, holdings from pf_summary where pfid = '$pfid' order by date desc limit 50) as base order by date;";
 $query = "select date, cash_in_hand, holdings from pf_summary where pfid = '{$pfid}' order by date ;;";
 $first = true;
 foreach ($pdo->query($query) as $row) {
     if ($first) {
         $first_date = $row['date'];
         $first = false;
     }
     $last_date = $row['date'];
     $holdings[] = $row['holdings'];
     $cash_in_hand[] = $row['cash_in_hand'];
     $dates[] = chartTime2(strtotime($row['date']));
 }
 // Create a XYChart object of size 300 x 210 pixels. Set the background to pale yellow
 // (0xffffc0) with a black border (0x0)
 $c = new XYChart(640, 480);
 // Set the plotarea at (50, 30) and of size 240 x 140 pixels. Use white (0xffffff)
 // background.
 $plotAreaObj = $c->setPlotArea(50, 30, 560, 400);
 $plotAreaObj->setBackground(0xffffff);
 // Add a legend box at (50, 185) (below of plot area) using horizontal layout. Use 8
 // pts Arial font with Transparent background.
 $legendObj = $c->addLegend(250, 445, false, "", 8);
 $legendObj->setBackground(Transparent);
 // Add a title box to the chart using 8 pts Arial Bold font, with yellow (0xffff40)
 // background and a black border (0x0)
 $textBoxObj = $c->addTitle("{$name} ({$pfid}) Performance ({$first_date} to {$last_date})", "arialbd.ttf", 8);
 $textBoxObj->setBackground(0xffff40, 0);
 // Set the y axis label format to US$nnnn
 $c->yAxis->setLabelFormat("£{value}");
 // Set the labels on the x axis.
$num = 0;
if (($handle = fopen($csvfile, "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
        $row++;
        for ($c = 0; $c < $num; $c++) {
            if ($c % 2) {
                array_push($competitors, $data[$c]);
            } else {
                array_push($services, $data[$c]);
            }
        }
    }
}
require_once "/var/www/ChartDirector/lib/phpchartdir.php";
$c = new XYChart(780, 390);
# Set the plotarea at (30, 20) and of size 200 x 200 pixels
$c->setPlotArea(40, 5, 750, 200, 0xe9fae7, 0xffffff);
# Add a title to the pie chart
$c->addTitle($display_geo);
# Add a line chart layer using the given data
$barLayerObj = $c->addBarLayer($competitors, 0x70e17513);
$barLayerObj->set3D();
$barLayerObj->setBarShape(CircleShape);
# Set the labels on the x axis.
$c->xAxis->setLabels($services);
$c->xAxis->setLabelStyle("Arial", 8, TextColor, 45);
# Add a title to the y axis
$c->yAxis->setTitle("Count of Service Providers");
# Add a title to the x axis
$c->xAxis->setTitle("Services");
Ejemplo n.º 8
0
<?php

include "../html/trader-functions.php";
#require_once("../ChartDirector/lib/FinanceChart.php");
require_once "../ChartDirector/lib/phpchartdir.php";
global $db_hostname, $db_database, $db_user, $db_password;
redirect_login_pf();
$username = $_SESSION['username'];
$uid = $_SESSION['uid'];
// make sure they're logged in"
if (isset($username)) {
    $c1 = new XYChart(640, 180);
    $c2 = new XYChart(640, 180);
    $c3 = new XYChart(640, 180);
    $m = new MultiChart(640, 3 * 180);
    $portfolio = new portfolio($_SESSION['pfid']);
    $pf_id = $portfolio->getID();
    $pf_name = $portfolio->getName();
    $pf_working_date = $portfolio->getWorkingDate();
    $pf_exch = $portfolio->getExch()->getID();
    $pf_exch_name = $portfolio->getExch()->getName();
    $endDate = chartTime2(strtotime($pf_working_date));
    if (isset($_SESSION['chart_period'])) {
        $chart_period = $_SESSION['chart_period'];
    } else {
        $chart_period = 180;
    }
    $durationInDays = (int) $chart_period;
    $startDate = $endDate - $durationInDays * 24 * 60 * 60;
    $first_date = $c1->formatValue($startDate, "{value|yyyy-mm-dd}");
    $count = 0;
Ejemplo n.º 9
0
if (($handle = fopen($_SESSION['csvfile'], "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
        $row++;
        for ($c = 0; $c < $num; $c++) {
            array_push($counts, $data[$c]);
            #for
        }
        # While
    }
    fclose($handle);
} else {
    echo "Error";
}
require_once "/var/www/ChartDirector/lib/phpchartdir.php";
# Create a Bar object of size 360 x 300 pixels
$c = new XYChart(500, 390);
$c->addTitle('Service Providers Available by Type of Match');
# Set the plotarea at (30, 20) and of size 200 x 200 pixels
$c->setPlotArea(20, 10, 440, 280, 0xe9fae7, 0xffffff);
$barLayerObj = $c->addBarLayer($counts, 0x8fc28a);
$barLayerObj->set3D();
$barLayerObj->setBarShape(CircleShape);
# Set the labels on the x axis.
$c->xAxis->setLabels($matchname);
$c->xAxis->setLabelStyle("Arial", 8, TextColor, 30);
# Add a title to the y axis
$c->yAxis->setTitle("Service Providers Available");
$filename = $path . "/consumer/charts/" . $imagename;
$_SESSION['imagename'] = $imagename;
$c->makeChart($filename);