本文整理汇总了PHP中pData::RemoveSerie方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::RemoveSerie方法的具体用法?PHP pData::RemoveSerie怎么用?PHP pData::RemoveSerie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::RemoveSerie方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _showGraph_pChart
public function _showGraph_pChart($buscarBarra)
{
// Dataset definition
$DataSet = new pData();
if ($buscarBarra == "semana") {
$semana = array("1era Semana", "2da Semana", "3era Semana", "4ta Semana");
$cantidadSemanal = array(2, 4, 5, 6);
$DataSet->AddPoint($semana, "Serie1");
$DataSet->AddPoint($cantidadSemanal, "Serie2");
// Initialise the graph
define("WIDTH", 500);
define("HEIGHT", 500);
$Test = new pChart(WIDTH, HEIGHT);
$Test->setFontProperties("../font/arial.ttf", 7);
$Test->setGraphArea(40, 30, WIDTH - 30, HEIGHT - 30);
$Test->drawFilledRoundedRectangle(7, 7, WIDTH - 7, HEIGHT - 7, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, WIDTH - 5, HEIGHT - 5, 5, 230, 230, 230);
} elseif ($buscarBarra == "mes") {
$mensual = array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Setiembre", "Octubre");
$cantidadMensual = array(4, 6, 11, 23, 9, 2, 30, 20, 12, 45);
$DataSet->AddPoint($mensual, "Serie1");
$DataSet->AddPoint($cantidadMensual, "Serie2");
// Initialise the graph
define("WIDTH", 700);
define("HEIGHT", 500);
$Test = new pChart(WIDTH, HEIGHT);
$Test->setFontProperties("../font/arial.ttf", 7);
$Test->setGraphArea(40, 30, WIDTH - 30, HEIGHT - 30);
$Test->drawFilledRoundedRectangle(7, 7, WIDTH - 7, HEIGHT - 7, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, WIDTH - 5, HEIGHT - 5, 5, 230, 230, 230);
$Test->setColorPalette(0, 224, 100, 46);
}
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("Serie1");
$DataSet->SetAbsciseLabelSerie("Serie1");
$DataSet->SetSerieName("Productos Comprados", "Serie2");
// Initialise the graph
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("../font/arial.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 70);
// Set labels
$Test->setFontProperties("../font/arial.ttf", 7);
$Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie2");
// Finish the graph
$Test->setFontProperties("../font/arial.ttf", 8);
$Test->drawLegend(WIDTH / 5, 25, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("../font/arial.ttf", 10);
$Test->drawTitle(WIDTH - 200, 22, "Estadistica de Barra de Grafico", 50, 50, 50, 185);
$Test->Render("../img/imagenBarra_pChart.png");
}
示例2: drawBar
/**
* Draw bar style chart
* @return unknown
*/
protected function drawBar()
{
// prepare font & series
$this->_prepareSerie();
$this->_prepareFont();
// init chart params
$outer_w = $this->w - 5;
// Outer frame witdh
$outer_h = $this->h - 5;
// Outer frame heigth
$inner_w = $this->w - 7;
// Inner frame witdh
$inner_h = $this->h - 7;
// Inner frame heigth
$chart_w = $this->w - 150;
// Chart frame witdh
$chart_h = $this->h - 40;
// Chart frame heigth
$title_w = $this->w - 200;
// Title width
$title_h = 45;
// Title height
$legend_w = $chart_w + 30;
// Legend width
$legend_h = 40;
// Legend height
// chart styles
$grid = isset($this->p['grid']) ? $this->p['grid'] : false;
// fill chart
$this->chart->drawBackground(255, 255, 255);
$this->chart->setFontProperties($this->font, 7);
// set font and size
$this->chart->drawRoundedRectangle(5, 5, $outer_w, $outer_h, 10, 230, 230, 230);
// drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
$this->chart->drawFilledRoundedRectangle(7, 7, $inner_w, $inner_h, 10, 240, 240, 240);
// drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
$this->chart->setGraphArea(90, 40, $chart_w, $chart_h);
// setGraphArea($X1,$Y1,$X2,$Y2)
$this->chart->drawGraphArea(255, 255, 255, TRUE);
// drawGraphArea($R,$G,$B)
$this->chart->drawScale($this->data->GetData(), $this->data->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, $this->margin, $this->skip);
// drawScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE)
$this->data->RemoveSerie('DEFAULT_SCALE');
// clear scale serie for setScale method
// draw grid
if ($grid) {
$this->chart->drawGrid(3, TRUE, 230, 230, 230, 50);
// drawGrid($LineWidth,$Mosaic=TRUE,$R=220,$G=220,$B=220,$Alpha=255)
}
// draw the cubic curve graph
$this->chart->drawBarGraph($this->data->GetData(), $this->data->GetDataDescription(), TRUE);
// add Title
$this->chart->setFontProperties($this->font, 10);
$this->chart->drawTitle(40, 0, $this->title, 50, 50, 50, $title_w, $title_h);
// drawTitle($XPos,$YPos,$Value,$R,$G,$B,$XPos2=-1,$YPos2=-1,$Shadow=FALSE)
// add Legend
$this->chart->setFontProperties($this->font, 8);
$this->chart->drawLegend($legend_w, $legend_h, $this->data->GetDataDescription(), 255, 255, 255);
// drawLegend($description,$R,$G,$B)
}
示例3: index
function index()
{
$this->load->model('charge_model');
$revenue = $this->charge_model->GetRevenueByDay($this->user->Get('client_id'));
$data = array();
if ($this->config->item('show_dashboard_chart') !== 'no' and !empty($revenue) and count($revenue) > 1) {
$series = array();
foreach ($revenue as $day) {
$series[] = $day['revenue'];
$series2[] = date("M j", strtotime($day['day']));
}
include APPPATH . 'libraries/pchart/pData.class';
include APPPATH . 'libraries/pchart/pChart.class';
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($series, "Revenue");
$DataSet->AddPoint($series2, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
$DataSet->RemoveSerie("Serie2");
$DataSet->SetXAxisName('Date');
$DataSet->SetYAxisName('Revenue');
//$DataSet->SetXAxisFormat('date');
// Initialise the graph
$Test = new pChart(1000, 260);
$Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 10);
$Test->setGraphArea(90, 30, 960, 200);
$Test->drawGraphArea(252, 252, 252);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
$Test->drawGrid(4, TRUE, 230, 230, 230, 255);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Finish the graph
$Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 8);
$Test->drawLegend(45, 35, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 10);
//$Test->drawTitle(60,22,"Last 30 Days",50,50,50,585);
$Test->Render(BASEPATH . '../writeable/rev_chart_' . $this->user->Get('client_id') . '.png');
} else {
$data['no_chart'] = 'true';
}
// get log
$this->load->model('log_model');
$log = $this->log_model->GetClientLog($this->user->Get('client_id'));
$data['log'] = $log;
$this->load->view(branded_view('cp/dashboard'), $data);
}
示例4: writeBarData
function writeBarData($data, $graph)
{
if ($data != "") {
echo "Plottong " . $graph . "\n";
$dataset1 = array();
$dataset2 = array();
$counter = 0;
$toggle = true;
$data = array_reverse($data, TRUE);
ksort($data);
foreach ($data as $key => $value) {
if ($counter % 5 != 0) {
$key = " ";
}
array_push($dataset1, $key);
array_push($dataset2, $value);
$counter++;
}
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($dataset2, "Serie1");
$DataSet->AddPoint($dataset1, "XLabel");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("XLabel");
$DataSet->RemoveSerie("XLabel");
$DataSet->SetSerieName("Membership", "Serie1");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 680, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), 'SCALE_NORMAL', 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(596, 150, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, "Membership by Month", 50, 50, 50, 585);
$Test->Render("{$graph}-bar.png");
}
}
示例5: generate_image
function generate_image($site_name, $visits)
{
$font = APP_PATH . "libs/pchart/Fonts/tahoma.ttf";
//$font = APP_PATH."includes/pchart/Fonts/DejaVuSans.ttf";
global $lang;
// Dataset definition
$DataSet = new pData();
$names = array();
$points = array();
foreach ($visits as $date => $visit) {
$points[] = $visit;
$text = $lang['days'][date('N', strtotime($date))];
$names[] = $text;
}
$DataSet->AddPoint($points, "Lankytojai");
$DataSet->AddPoint($names, "days");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("days");
$DataSet->SetAbsciseLabelSerie('days');
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties($font, 8);
$Test->setGraphArea(50, 30, 680, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties($font, 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE, 80);
// Finish the graph
$Test->setFontProperties($font, 8);
// $Test->drawLegend(100,20,$DataSet->GetDataDescription(),255,255,255);
$Test->drawLegend(610, 10, $DataSet->GetDataDescription(), 236, 238, 240, 52, 58, 82);
$Test->setFontProperties($font, 10);
$Test->drawTitle(50, 22, $site_name, 50, 50, 50, 585);
$path = IMAGE_PATH . "{$site_name}.png";
if (file_exists($path)) {
unlink($path);
}
$Test->Render($path);
return $path;
}
示例6: pChart
$DataSet->SetYAxisName("Response time");
$DataSet->SetXAxisName("Sample #ID");
//print_r($DataSet->GetData());
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(55, 30, 585, 185);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the line graph
$DataSet->RemoveSerie("Serie2");
$Test->drawFilledLineGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 60, TRUE);
// Draw the curve graph
$DataSet->RemoveSerie("Serie1");
$DataSet->AddSerie("Serie2");
$Test->setShadowProperties(2, 2, 200, 200, 200, 50);
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
$Test->clearShadow();
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, "Example 18", 50, 50, 50, 585);
$Test->Render("example18.png");
示例7: createChart
function createChart(&$info, &$cfg)
{
$backgndColor = array('R' => 255, 'G' => 255, 'B' => 254);
$chartCfg = new stdClass();
$chartCfg->XSize = $info->canDraw ? $cfg->XSize : 600;
$chartCfg->YSize = $info->canDraw ? $cfg->YSize : 50;
$chartCfg->border = new stdClass();
$chartCfg->border->width = 1;
$chartCfg->border->color = array('R' => 0, 'G' => 0, 'B' => 0);
$chartCfg->graphArea = new stdClass();
$chartCfg->graphArea->color = array('R' => 213, 'G' => 217, 'B' => 221);
$chartCfg->graphArea->beginX = 40;
$chartCfg->graphArea->beginY = 40;
$chartCfg->graphArea->endX = $chartCfg->XSize - $chartCfg->graphArea->beginX;
$chartCfg->graphArea->endY = $chartCfg->YSize - $chartCfg->graphArea->beginY;
$chartCfg->scale = new stdClass();
$chartCfg->scale->mode = SCALE_ADDALL;
$chartCfg->scale->color = array('R' => 0, 'G' => 0, 'B' => 0);
$chartCfg->scale->drawTicks = TRUE;
$chartCfg->scale->angle = $cfg->scale->legendXAngle;
$chartCfg->scale->decimals = 1;
$chartCfg->scale->withMargin = TRUE;
$chartCfg->legend = new stdClass();
$chartCfg->legend->X = $chartCfg->XSize - 80;
$chartCfg->legend->Y = 15;
$chartCfg->legend->color = array('R' => 236, 'G' => 238, 'B' => 240);
$chartCfg->title = new stdClass();
$chartCfg->title->value = $cfg->chartTitle;
$chartCfg->title->X = 2 * $chartCfg->graphArea->beginX;
$chartCfg->title->Y = $chartCfg->legend->Y;
$chartCfg->title->color = array('R' => 0, 'G' => 0, 'B' => 255);
$Test = new pChart($chartCfg->XSize, $chartCfg->YSize);
$Test->drawBackground($backgndColor['R'], $backgndColor['G'], $backgndColor['B']);
$Test->drawGraphArea($chartCfg->graphArea->color['R'], $chartCfg->graphArea->color['G'], $chartCfg->graphArea->color['B']);
$Test->setGraphArea($chartCfg->graphArea->beginX, $chartCfg->graphArea->beginY, $chartCfg->graphArea->endX, $chartCfg->graphArea->endY);
$Test->setFontProperties(config_get('charts_font_path'), config_get('charts_font_size'));
if ($info->canDraw) {
$DataSet = new pData();
foreach ($info->chart_data as $key => $values) {
$id = $key + 1;
$DataSet->AddPoint($values, "Serie{$id}");
$DataSet->SetSerieName($info->series_label[$key], "Serie{$id}");
}
$DataSet->AddPoint($info->xAxis->values, $info->xAxis->serieName);
$DataSet->AddAllSeries();
$DataSet->RemoveSerie($info->xAxis->serieName);
$DataSet->SetAbsciseLabelSerie($info->xAxis->serieName);
$chartData = $DataSet->GetData();
$chartLegend = $DataSet->GetDataDescription();
foreach ($info->series_color as $key => $hexrgb) {
$rgb = str_split($hexrgb, 2);
$Test->setColorPalette($key, hexdec($rgb[0]), hexdec($rgb[1]), hexdec($rgb[2]));
}
// $Test->setFixedScale($info->scale->minY,$info->scale->maxY,$info->scale->divisions);
$Test->drawScale($chartData, $chartLegend, $chartCfg->scale->mode, $chartCfg->scale->color['R'], $chartCfg->scale->color['G'], $chartCfg->scale->color['B'], $chartCfg->scale->drawTicks, $chartCfg->scale->angle, $chartCfg->scale->decimals, $chartCfg->scale->withMargin);
$Test->drawStackedBarGraph($chartData, $chartLegend, 70);
// Draw the legend
$Test->setFontProperties(config_get('charts_font_path'), config_get('charts_font_size'));
$Test->drawLegend($chartCfg->legend->X, $chartCfg->legend->Y, $chartLegend, $chartCfg->legend->color['R'], $chartCfg->legend->color['G'], $chartCfg->legend->color['B']);
$Test->addBorder($chartCfg->border->width, $chartCfg->border->color['R'], $chartCfg->border->color['G'], $chartCfg->border->color['B']);
} else {
$chartCfg->title->value .= '/' . lang_get('no_data_available');
}
$Test->drawTitle($chartCfg->title->X, $chartCfg->title->Y, $chartCfg->title->value, $chartCfg->title->color['R'], $chartCfg->title->color['G'], $chartCfg->title->color['B']);
$Test->Stroke();
}
示例8: grapher
/**
* This function draw the graphic to be displayed on the user view as an image
*
* @param array $sql_result
* @param string $start_date
* @param string $end_date
* @param string $type
* @author Jorge Frisancho Jibaja
* @version OCT-22- 2010
* @return string
*/
function grapher($sql_result, $start_date, $end_date, $type = "") {
require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php';
if (empty($start_date)) { $start_date =""; }
if (empty($end_date)) { $end_date =""; }
if ($type == ""){ $type = 'day'; }
$main_year = $main_month_year = $main_day = array();
// get last 8 days/months
$last_days = 5;
$last_months = 3;
for ($i = $last_days; $i >= 0; $i--) {
$main_day[date ('d-m-Y', mktime () - $i * 3600 * 24)] = 0;
}
for ($i = $last_months; $i >= 0; $i--) {
$main_month_year[date ('m-Y', mktime () - $i * 30 * 3600 * 24)] = 0;
}
$i = 0;
if (is_array($sql_result) && count($sql_result) > 0) {
foreach ($sql_result as $key => $data) {
//creating the main array
$main_month_year[date('m-Y', $data['login'])] += float_format(($data['logout'] - $data['login']) / 60, 0);
$main_day[date('d-m-Y', $data['login'])] += float_format(($data['logout'] - $data['login']) / 60, 0);
if ($i > 500) {
break;
}
$i++;
}
switch ($type) {
case 'day':
$main_date = $main_day;
break;
case 'month':
$main_date = $main_month_year;
break;
case 'year':
$main_date = $main_year;
break;
}
// the nice graphics :D
$labels = array_keys($main_date);
if (count($main_date) == 1) {
$labels = $labels[0];
$main_date = $main_date[$labels];
}
$data_set = new pData();
$data_set->AddPoint($main_date, 'Q');
if (count($main_date)!= 1) {
$data_set->AddPoint($labels, 'Date');
}
$data_set->AddAllSeries();
$data_set->RemoveSerie('Date');
$data_set->SetAbsciseLabelSerie('Date');
$data_set->SetYAxisName(get_lang('Minutes', ''));
$graph_id = api_get_user_id().'AccessDetails'.api_get_course_id().$start_date.$end_date.$type;
$data_set->AddAllSeries();
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if (0) {
//if we already created the img
// echo 'in cache';
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
} else {
// if the image does not exist in the archive/ folder
// Initialise the graph
$test = new pChart(760, 230);
//which schema of color will be used
$quant_resources = count($data[0]) - 1;
// Adding the color schemma
$test->loadColorPalette(api_get_path(LIBRARY_PATH).'pchart/palette/default.txt');
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8);
$test->setGraphArea(70, 30, 680, 200);
$test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$test->drawGraphArea(255, 255, 255, TRUE);
$test->drawScale($data_set->GetData(), $data_set->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 0);
$test->drawGrid(4, TRUE, 230, 230, 230, 50);
$test->setLineStyle(2);
//.........这里部分代码省略.........
示例9: createChart
function createChart(&$info, &$cfg)
{
$backgndColor = array('R' => 255, 'G' => 255, 'B' => 254);
$chartCfg = new stdClass();
$chartCfg->XSize = $info->canDraw ? $cfg->XSize : 600;
$chartCfg->YSize = $info->canDraw ? $cfg->YSize : 50;
$chartCfg->border = new stdClass();
$chartCfg->border->width = 1;
$chartCfg->border->color = array('R' => 0, 'G' => 0, 'B' => 0);
$chartCfg->graphArea = new stdClass();
$chartCfg->graphArea->color = array('R' => 213, 'G' => 217, 'B' => 221);
$chartCfg->graphArea->beginX = property_exists($cfg, 'beginX') ? $cfg->beginX : 40;
$chartCfg->graphArea->beginY = property_exists($cfg, 'beginY') ? $cfg->beginY : 100;
$chartCfg->graphArea->endX = $chartCfg->XSize - $chartCfg->graphArea->beginX;
$chartCfg->graphArea->endY = $chartCfg->YSize - $chartCfg->graphArea->beginY;
$chartCfg->scale = new stdClass();
// 20100914 - franciscom
// After reading documentation
// drawScale
// Today there is four way of computing scales :
//
// - Getting Max & Min values per serie : ScaleMode = SCALE_NORMAL
// - Like the previous one but setting the min value to 0 : ScaleMode = SCALE_START0
// - Getting the series cumulative Max & Min values : ScaleMode = SCALE_ADDALL
// - Like the previous one but setting the min value to 0 : ScaleMode = SCALE_ADDALLSTART0
//
// This will depends on the kind of graph you are drawing, today only the stacked bar chart
// can use the SCALE_ADDALL mode.
// Drawing graphs were you want to fix the min value to 0 you must use the SCALE_START0 option.
//
$chartCfg->scale->mode = SCALE_ADDALLSTART0;
$chartCfg->scale->color = array('R' => 0, 'G' => 0, 'B' => 0);
$chartCfg->scale->drawTicks = TRUE;
$chartCfg->scale->angle = $cfg->scale->legendXAngle;
$chartCfg->scale->decimals = 1;
$chartCfg->scale->withMargin = TRUE;
$chartCfg->legend = new stdClass();
$chartCfg->legend->X = $chartCfg->XSize - 80;
$chartCfg->legend->Y = 15;
$chartCfg->legend->color = array('R' => 236, 'G' => 238, 'B' => 240);
$chartCfg->title = new stdClass();
$chartCfg->title->value = $cfg->chartTitle;
$chartCfg->title->X = 2 * $chartCfg->graphArea->beginX;
$chartCfg->title->Y = $chartCfg->legend->Y;
$chartCfg->title->color = array('R' => 0, 'G' => 0, 'B' => 255);
$Test = new pChart($chartCfg->XSize, $chartCfg->YSize);
$Test->reportWarnings("GD");
$Test->drawBackground($backgndColor['R'], $backgndColor['G'], $backgndColor['B']);
$Test->drawGraphArea($chartCfg->graphArea->color['R'], $chartCfg->graphArea->color['G'], $chartCfg->graphArea->color['B']);
$Test->setGraphArea($chartCfg->graphArea->beginX, $chartCfg->graphArea->beginY, $chartCfg->graphArea->endX, $chartCfg->graphArea->endY);
$Test->setFontProperties(config_get('charts_font_path'), config_get('charts_font_size'));
if ($info->canDraw) {
$DataSet = new pData();
foreach ($info->chart_data as $key => $values) {
$id = $key + 1;
$DataSet->AddPoint($values, "Serie{$id}");
$DataSet->SetSerieName($info->series_label[$key], "Serie{$id}");
}
$DataSet->AddPoint($info->xAxis->values, $info->xAxis->serieName);
$DataSet->AddAllSeries();
$DataSet->RemoveSerie($info->xAxis->serieName);
$DataSet->SetAbsciseLabelSerie($info->xAxis->serieName);
$chartData = $DataSet->GetData();
$chartLegend = $DataSet->GetDataDescription();
foreach ($info->series_color as $key => $hexrgb) {
$rgb = str_split($hexrgb, 2);
$Test->setColorPalette($key, hexdec($rgb[0]), hexdec($rgb[1]), hexdec($rgb[2]));
}
// $Test->setFixedScale($info->scale->minY,$info->scale->maxY,$info->scale->divisions);
$Test->drawScale($chartData, $chartLegend, $chartCfg->scale->mode, $chartCfg->scale->color['R'], $chartCfg->scale->color['G'], $chartCfg->scale->color['B'], $chartCfg->scale->drawTicks, $chartCfg->scale->angle, $chartCfg->scale->decimals, $chartCfg->scale->withMargin);
$Test->drawStackedBarGraph($chartData, $chartLegend, 70);
// Draw the legend
$Test->setFontProperties(config_get('charts_font_path'), config_get('charts_font_size'));
$Test->drawLegend($chartCfg->legend->X, $chartCfg->legend->Y, $chartLegend, $chartCfg->legend->color['R'], $chartCfg->legend->color['G'], $chartCfg->legend->color['B']);
$Test->addBorder($chartCfg->border->width, $chartCfg->border->color['R'], $chartCfg->border->color['G'], $chartCfg->border->color['B']);
} else {
$chartCfg->title->value .= '/' . lang_get('no_data_available');
}
$Test->drawTitle($chartCfg->title->X, $chartCfg->title->Y, $chartCfg->title->value, $chartCfg->title->color['R'], $chartCfg->title->color['G'], $chartCfg->title->color['B']);
$Test->Stroke();
}
示例10: build
public function build()
{
require_once PCHART_BASE_DIR . DIRECTORY_SEPARATOR . 'pData.php';
require_once PCHART_BASE_DIR . DIRECTORY_SEPARATOR . 'pChart.php';
$dataSet = new pData();
foreach ($this->lines as $name => $ordinateValues) {
if (count($ordinateValues) != count($this->absciseValues)) {
throw new Exception('Count of line "' . $name . '" ordinate points "' . count($ordinateValues) . '" mismatch to abscise points "' . count($this->absciseValues) . '"');
}
$dataSet->AddPoint($ordinateValues, $name);
}
$dataSet->AddPoint($this->absciseValues, 'Abscise');
$dataSet->AddAllSeries();
$dataSet->RemoveSerie('Abscise');
$dataSet->SetAbsciseLabelSerie('Abscise');
foreach ($this->lines as $name => $ordinateValues) {
$dataSet->SetSerieName($name, $name);
}
$dataSet->SetYAxisUnit($this->ordinateStepTitle);
$dataSet->SetXAxisUnit($this->absciseStepTitle);
$chart = new pChart($this->maxWidth, $this->maxHeight);
$chart->drawGraphAreaGradient(132, 153, 172, 50, TARGET_BACKGROUND);
// Graph area setup
$chart->setFontProperties(PCHART_FONTS_DIR . DIRECTORY_SEPARATOR . 'tahoma.ttf', 10);
$chart->setGraphArea($this->graphMargins[0], $this->graphMargins[1], $this->maxWidth - $this->graphMargins[2], $this->maxHeight - $this->graphMargins[3]);
$chart->drawGraphArea(213, 217, 221, FALSE);
$ordinateScaleMargin = ($this->getMaxOrdinateValue() - $this->getMinOrdinateValue()) / $this->ordinateDevisions;
$chart->setFixedScale($this->getMinOrdinateValue() - $ordinateScaleMargin, $this->getMaxOrdinateValue() + $ordinateScaleMargin, $this->ordinateDevisions);
$chart->drawScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_NORMAL, 213, 217, 221, TRUE, 0, 2);
$chart->drawGraphAreaGradient(162, 183, 202, 50);
$chart->drawGrid(4, TRUE, 230, 230, 230, 20);
// Draw the line chart
// $chart->setShadowProperties(1, 1, 0, 0, 0, 30, 4);
$chart->drawLineGraph($dataSet->GetData(), $dataSet->GetDataDescription());
$chart->clearShadow();
$chart->drawPlotGraph($dataSet->GetData(), $dataSet->GetDataDescription(), 5, 3, -1, -1, -1, TRUE);
// Draw the legend
$chart->drawLegend($this->maxWidth - $this->graphMargins[2] + 10, $this->graphMargins[1], $dataSet->GetDataDescription(), 236, 238, 240, 52, 58, 82);
// Draw chart title
if ($this->chartTitle) {
$chart->drawTextBox(0, $this->maxHeight - 20, $this->maxWidth, $this->maxHeight, $this->chartTitle, 0, 255, 255, 255, ALIGN_RIGHT, TRUE, 0, 0, 0, 30);
}
// Render the picture
$chart->addBorder(2);
$chart->Render($this->outputFilepath);
}
示例11: date
$maxNumber = $dbData[1][0][1];
for ($p = 0; $p < count($dbData[0]); $p++) {
$data_server = $dbData[0][$p];
for ($i = 0; $i < count($data_server); $i++) {
if ($i == 0) {
$XAxis[] = date("H:i", $data_server[$i]);
} else {
$OLNum[] = $data_server[$i];
}
}
}
$pChartDataSet = new pData();
$pChartDataSet->AddPoint($XAxis, "Serie1");
$pChartDataSet->AddPoint($OLNum, "Serie2");
$pChartDataSet->AddSerie("Serie2");
$pChartDataSet->RemoveSerie("Serie1");
$pChartDataSet->SetAbsciseLabelSerie("Serie1");
$pChartDataSet->SetYAxisName("在\n线\n人\n数\n//\n人");
$pChartDataSet->SetYAxisFormat("floor");
$pChartDataSet->SetXAxisFormat("number");
// 设置作图区域
$pChartGraph = new pChart($imgWidth, 253);
$pChartGraph->drawGraphAreaGradient(90, 90, 90, 90, TARGET_BACKGROUND);
$pChartGraph->setGraphArea(70, 30, $imgWidth + 70 - 90, 253 + 30 - 80);
$pChartGraph->setFontProperties(DRAWFONE_PATH, 8);
$pChartGraph->drawScale($pChartDataSet->GetData(), $pChartDataSet->GetDataDescription(), SCALE_NORMAL, 250, 250, 250, TRUE, 0, 0, FALSE, 1);
// 开始作图
$pChartGraph->setColorPalette(0, 0, 255, 255);
$pChartGraph->drawGraphAreaGradient(40, 40, 40, -50);
$pChartGraph->drawGrid(1, TRUE, 115, 115, 115, 10);
$pChartGraph->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
示例12:
$DataSet->SetAbsciseLabelSerie('SerieDate');
$DataSet->SetSerieName('Skill', 'SerieSkill');
$DataSet->SetSerieName('Session', 'SerieSession');
$Chart->setFontProperties(IMAGE_PATH . '/sig/font/DejaVuSans.ttf', 7);
$DataSet->SetYAxisName('Skill');
$DataSet->SetYAxisUnit('K');
$Chart->setColorPalette(0, 255, 255, 0);
$Chart->drawRightScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, $color['red'], $color['green'], $color['blue'], TRUE, 0, 0);
$Chart->drawGrid(1, FALSE, 55, 55, 55, 100);
$Chart->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$Chart->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Chart->clearShadow();
$Chart->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
$Chart->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 1, 1, 255, 255, 255);
$Chart->clearScale();
$DataSet->RemoveSerie('SerieSkill');
$DataSet->AddSerie('SerieSession');
$DataSet->SetYAxisName('Session');
$DataSet->SetYAxisUnit('');
$Chart->setColorPalette(1, 255, 0, 0);
$Chart->setColorPalette(2, 0, 0, 255);
$Chart->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, $color['red'], $color['green'], $color['blue'], TRUE, 0, 0);
$Chart->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$Chart->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Chart->clearShadow();
$Chart->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 1, 1, 255, 255, 255);
$Chart->setFontProperties(IMAGE_PATH . '/sig/font/DejaVuSans.ttf', 7);
$Chart->drawHorizontalLegend(235, -1, $DataSet->GetDataDescription(), 0, 0, 0, 0, 0, 0, $color['red'], $color['green'], $color['blue'], FALSE);
}
$cache_image = IMAGE_PATH . "/progress/trend_{$player}_{$last_time}.png";
$Chart->Render($cache_image);
示例13: pData
return -1;
}
}
}
$DB->close();
// Build Bar Chart for zipcodes
include "../pChart/pChart/pData.class";
include "../pChart/pChart/pChart.class";
$DataSet = new pData();
foreach ($zipcodes as $zipcode) {
$DataSet->AddPoint($zipcode["quantity"], "Series1");
$DataSet->AddPoint($zipcode["zipcode"], "Series2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Series2");
$DataSet->SetSerieName("Sales By Zip Code", "Series1");
$DataSet->RemoveSerie("Series2");
}
//$firephp->log($zipcodes);
//$firephp->log($DataSet);
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setColorPalette(0, 38, 33, 204);
$Test->setFontProperties("../pChart/Fonts/tahoma.ttf", 10);
$Test->setGraphArea(50, 50, 680, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("../pChart/Fonts/tahoma.ttf", 14);
示例14: pData
<?php
/*
Example23 : Playing with background bis
*/
// Standard inclusions
include "../lib/pData.php";
include "../lib/pChart.php";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(9, 9, 9, 10, 10, 11, 12, 14, 16, 17, 18, 18, 19, 19, 18, 15, 12, 10, 9), "Serie1");
$DataSet->AddPoint(array(10, 11, 11, 12, 12, 13, 14, 15, 17, 19, 22, 24, 23, 23, 22, 20, 18, 16, 14), "Serie2");
$DataSet->AddPoint(array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22), "Serie3");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("Serie3");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
$DataSet->SetYAxisName("Temperature");
$DataSet->SetYAxisUnit("°C");
$DataSet->SetXAxisUnit("h");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->drawGraphAreaGradient(132, 173, 131, 50, TARGET_BACKGROUND);
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->setGraphArea(120, 20, 675, 190);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALL, 213, 217, 221, TRUE, 0, 2, TRUE);
$Test->drawGraphAreaGradient(163, 203, 167, 50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 20);
// Draw the bar chart
示例15: get_evaluations_courses_in_sessions_graph
/**
* This method return a graph containing information about evaluations
* inside courses in sessions, it's used inside get_block method for
* showing it inside dashboard interface
* @return string img html
*/
public function get_evaluations_courses_in_sessions_graph()
{
$graphs = array();
if (!empty($this->sessions)) {
$session_ids = array_keys($this->sessions);
foreach ($session_ids as $session_id) {
$courses_code = array_keys(Tracking::get_courses_list_from_session($session_id));
$courses_graph = array();
foreach ($courses_code as $course_code) {
$cats = Category::load(null, null, $course_code, null, null, $session_id);
if (isset($cats) && isset($cats[0])) {
$alleval = $cats[0]->get_evaluations(null, true, $course_code);
$alllinks = $cats[0]->get_links(null, true);
$users = get_all_users($alleval, $alllinks);
$datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
$evaluation_sumary = $datagen->get_evaluation_sumary_results();
if (!empty($evaluation_sumary)) {
$items = array_keys($evaluation_sumary);
$max = $min = $avg = array();
foreach ($evaluation_sumary as $evaluation) {
$max[] = $evaluation['max'];
$min[] = $evaluation['min'];
$avg[] = $evaluation['avg'];
}
// Dataset definition
$data_set = new pData;
$data_set->AddPoint($max, "Max");
$data_set->AddPoint($avg, "Avg");
$data_set->AddPoint($min, "Min");
$data_set->AddPoint($items, "Items");
$data_set->SetXAxisName(get_lang('EvaluationName'));
$data_set->SetYAxisName(get_lang('Percentage'));
$data_set->AddAllSeries();
$data_set->RemoveSerie("Items");
$data_set->SetAbsciseLabelSerie("Items");
$graph_id = $this->user_id.'StudentEvaluationGraph';
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data)) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data);
} else {
// Initialise the graph
$angle = -30;
$test = new pChart($this->bg_width, $this->bg_height);
$test->setFontProperties(api_get_path(LIBRARY_PATH) . 'pchart/fonts/tahoma.ttf', 8);
$test->fixHeightByRotation(
$data_set->GetData(),
$data_set->GetDataDescription(),
$angle
);
$test->setGraphArea(50, 30, $this->bg_width - 75, $this->bg_height - 75);
$test->drawFilledRoundedRectangle(
7,
7,
$this->bg_width - 20,
$test->YSize - 20,
5,
240,
240,
240
);
$test->drawRoundedRectangle(
5,
5,
$this->bg_width - 18,
$test->YSize - 18,
5,
230,
230,
230
);
$test->drawGraphArea(255,255,255,TRUE);
$test->setFixedScale(0,100,5);
$test->drawScale(
$data_set->GetData(),
$data_set->GetDataDescription(),
SCALE_ADDALL,
150,
150,
150,
TRUE,
$angle,
2,
TRUE
);
$test->setColorPalette(0,105,221,34);
$test->setColorPalette(1,255,135,30);
$test->setColorPalette(2,255,0,0);
$test->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
$test->drawTreshold(0,143,55,72,TRUE,TRUE);
//.........这里部分代码省略.........