} } } fclose($handle); } else { echo "Error"; } array_shift($count); array_shift($matchdate); 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 line chart $c->addTitle($display_date . ' / ' . $display_geo); # Add a line chart layer using the given data $lineObj = $c->addLineLayer($count, 0xe17513); $lineObj->set3D(); $c->yAxis->setTickDensity(30); $c->xAxis->setTickDensity(75); # Set the labels on the x axis. $c->xAxis->setLabels($matchdate); $labelsObj = $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(" by Day"); $labelsObj = $c->xAxis->setLabels($matchdate); $labelsObj->setFontAngle(70); $labelsObj->setFontStyle("arial.ttf");
} } 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"); $labelsObj = $c->xAxis->setLabels($matchdate); $labelsObj->setFontAngle(70); $labelsObj->setFontStyle("arial.ttf"); $labelsObj->setFontSize(9);
if ($first) { // save the first found date for the chart title $first_date = $row['date']; $first = false; } } // Set the plotarea at (50, 30) and of size 240 x 140 pixels. Use white (0xffffff) // background. $plotAreaObj = $c->setPlotArea(50, 45, 410, 400, 0xffffff, 0xffffff, 0xc0c0c0, 0xc0c0c0, 0xc0c0c0); // 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(50, 455, 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("{$symb}.{$pf_exch}: {$symb_name}\nExponential Moving Averages from {$first_date} to {$pf_working_date}", "arialbd.ttf", 12); // Set the y axis label format to US$nnnn $c->yAxis->setLabelFormat("£{value}"); $m_yearFormat = "{value|yyyy}"; $m_firstMonthFormat = "<*font=bold*>{value|mmm yy}"; $m_otherMonthFormat = "{value|mmm}"; $m_firstDayFormat = "<*font=bold*>{value|d mmm}"; $m_otherDayFormat = "{value|d}"; $m_firstHourFormat = "<*font=bold*>{value|d mmm\nh:nna}"; $m_otherHourFormat = "{value|h:nna}"; $m_timeLabelSpacing = 50; $c->xAxis->setMultiFormat(StartOfDayFilter(), $m_firstDayFormat, StartOfDayFilter(1, 0.5), $m_otherDayFormat, 1); $layer = $c->addLineLayer2(); $layer->setXData($dates); $layer->addDataSet($ema_12, -1, "12 day"); $layer->addDataSet($ema_26, -1, "26 day");
if ($first) { // save the first found date for the chart title $first_date = $row['date']; $first = false; } } // Set the plotarea at (50, 30) and of size 240 x 140 pixels. Use white (0xffffff) // background. $plotAreaObj = $c->setPlotArea(50, 45, 410, 100, 0xffffff, 0xffffff, 0xc0c0c0, 0xc0c0c0, 0xc0c0c0); // 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(50, 45, 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("{$symb}.{$pf_exch}: {$symb_name}\n10 day Simple Moving Average Diff from {$first_date} to {$pf_working_date}", "arialbd.ttf", 12); // Set the y axis label format to US$nnnn $c->yAxis->setLabelFormat("£{value}"); // Set the labels on the x axis. $m_yearFormat = "{value|yyyy}"; $m_firstMonthFormat = "<*font=bold*>{value|mmm yy}"; $m_otherMonthFormat = "{value|mmm}"; $m_firstDayFormat = "<*font=bold*>{value|d mmm}"; $m_otherDayFormat = "{value|d}"; $m_firstHourFormat = "<*font=bold*>{value|d mmm\nh:nna}"; $m_otherHourFormat = "{value|h:nna}"; $m_timeLabelSpacing = 50; $c->xAxis->setMultiFormat(StartOfDayFilter(), $m_firstDayFormat, StartOfDayFilter(1, 0.5), $m_otherDayFormat, 1); $barLayerObj = $c->addBarLayer($ma_10_diff); $barLayerObj->setUseYAxis2(); $barLayerObj->setXData($dates);
$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. // Display 1 out of 2 labels on the x-axis. Show minor ticks for remaining labels. $m_yearFormat = "{value|yyyy}"; $m_firstMonthFormat = "<*font=bold*>{value|mmm yy}"; $m_otherMonthFormat = "{value|mmm}"; $m_firstDayFormat = "<*font=bold*>{value|d mmm}"; $m_otherDayFormat = "{value|d}"; $m_firstHourFormat = "<*font=bold*>{value|d mmm\nh:nna}"; $m_otherHourFormat = "{value|h:nna}"; $m_timeLabelSpacing = 50; $c->xAxis->setMultiFormat(StartOfDayFilter(), $m_firstDayFormat, StartOfDayFilter(1, 0.5), $m_otherDayFormat, 1); // Add an stack area layer with three data sets
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"); $filename = $path . "/provider/charts/tempimages/" . $imagename; $c->makeChart($filename);
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);