本文整理汇总了PHP中pData::SetYAxisName方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::SetYAxisName方法的具体用法?PHP pData::SetYAxisName怎么用?PHP pData::SetYAxisName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::SetYAxisName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateGraph
function generateGraph($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to)
{
$myarr = graphTests($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
$myarr1 = graphErrs($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
$myarr2 = graphLbls($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
// Standard inclusions
include "pChart/pChart/pData.class";
include "pChart/pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($myarr, "Serie1");
$DataSet->AddPoint($myarr1, "Serie2");
$DataSet->AddPoint($myarr2, "Serie3");
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("Test Resulting trends", "Serie1");
$DataSet->SetSerieName("Errors in tests", "Serie2");
$DataSet->SetYAxisName("Tests");
// $DataSet->SetYAxisFormat("time");
$DataSet->SetXAxisName("months");
// Initialise the graph
$Test = new pChart(750, 330);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(85, 30, 650, 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);
$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
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(90, 35, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(60, 22, "Test Summary", 50, 50, 50, 585);
$Test->Render("mpdf.png");
}
示例2: make
public function make($working_path)
{
// This will import the file http://my.domain.com/myData.csv using each column as a serie
if (!$this->plot->valid()) {
$file = $this->plot->name();
$error = $this->plot->error();
$this->log($working_path, "Plot file {$file} is invalid: {$error}");
return 1;
}
$data = new pData();
$columns = array();
$all_columns = array();
$x_column = $this->plot->property('x_column') - 1;
if ($x_column === NULL) {
$x_column = 0;
}
$data_file = $this->plot->data_property('name');
$deliminator = $this->plot->data_property('deliminator');
$has_header = $this->plot->data_property('header') == 'yes';
foreach ($this->plot->columns() as $column => $name) {
if ($column != $x_column + 1) {
$columns[] = $column - 1;
}
$all_columns[] = $column - 1;
}
$data->ImportFromCSV($working_path . $data_file, $deliminator, $all_columns, $has_header);
foreach ($columns as $column) {
$name = $this->plot->column($column + 1);
$data->AddSerie('Serie' . $column);
$data->SetSerieName($name, "Serie" . $column);
}
$max_col = -1;
$max_val = NULL;
foreach ($data->GetData() as $record) {
foreach ($columns as $column) {
$point = $record['Serie' . $column];
if ($max_val === NULL || $point > $max_val) {
$max_val = $point;
$max_col = $column;
}
}
}
$x_label = $this->plot->axis_property('x', 'label');
if ($x_label) {
$data->SetXAxisName($x_label);
} else {
$data->SetXAxisName($this->plot->column($x_column + 1));
}
$x_unit = $this->plot->axis_property('x', 'unit');
if ($x_unit) {
$data->SetXAxisUnit($x_unit);
}
$y_label = $this->plot->axis_property('y', 'label');
reset($columns);
if ($y_label) {
$data->SetYAxisName($y_label);
} else {
$data->SetYAxisName($this->plot->column(current($columns) + 1));
}
$y_unit = $this->plot->axis_property('y', 'unit');
if ($y_unit) {
$data->SetyAxisUnit($y_unit);
}
$width = $this->plot->property('width');
if (!$width) {
$width = 640;
}
$height = $this->plot->property('height');
if (!$height) {
$height = 480;
}
$plot = new pChart($width, $height);
$font_name = $this->plot->property('font-name');
if (!$font_name) {
$font_name = 'tahoma.ttf';
}
$font_name = 'lib/plugins/projects/pchart/fonts/' . $font_name;
$font_size = $this->plot->property('font_size');
if (!$font_size) {
$font_size = 12;
}
$plot->setFontProperties($font_name, $font_size);
$h = $font_size + 10;
$left_margin = 0;
foreach ($data->GetData() as $record) {
$position = imageftbbox($font_size, 0, $font_name, $record['Serie' . $max_col]);
$text_width = $position[2] - $position[0];
if ($text_width > $left_margin) {
$left_margin = $text_width;
}
}
$left_margin += 2 * $h;
$plot->setGraphArea($left_margin, 2 * $h, $width - $h, $height - 2 * $h);
$background = $this->plot->property('background');
if (!$background) {
$background = array('R' => 255, 'G' => 255, 'B' => 255);
} else {
$background = html_color_to_RGB($background);
}
$plot->drawGraphArea($background['R'], $background['G'], $background['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: prepareData
function prepareData($scaleX, $scaleY, $SQL, $scaleType)
{
global $conn;
$DataSet = new pData();
$result = pg_query($conn, $SQL);
if (!$result) {
echo "An error occured.\n";
}
while ($row = pg_fetch_row($result)) {
$DataSet->AddPoint($row[1], "Serie2");
$DataSet->AddPoint(mktime(0, 0, 0, substr($row[0], 5, 2), substr($row[0], 8, 2), substr($row[0], 0, 4)), "Serie1");
}
$DataSet->SetAbsciseLabelSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetYAxisName($scaleY);
$DataSet->SetXAxisFormat($scaleType);
return $DataSet;
}
示例5: pChart
$DataSet->AddPoint(array(700, 2705, 2041, 1712, 2051, 846, 903), "Serie2");
$DataSet->AddPoint(array("03 Oct", "02 Oct", "01 Oct", "30 Sep", "29 Sep", "28 Sep", "27 Sep"), "Serie3");
$DataSet->AddSerie("Serie1");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("SourceForge Rank", "Serie1");
$DataSet->SetSerieName("Web Hits", "Serie2");
// Initialise the graph
$Test = new pChart(660, 230);
$Test->drawGraphAreaGradient(90, 90, 90, 90, TARGET_BACKGROUND);
// Prepare the graph area
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->setGraphArea(60, 40, 595, 190);
// Initialise graph area
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
// Draw the SourceForge Rank graph
$DataSet->SetYAxisName("Sourceforge Rank");
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 213, 217, 221, TRUE, 0, 0);
$Test->drawGraphAreaGradient(40, 40, 40, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 10);
$Test->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->clearShadow();
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Clear the scale
$Test->clearScale();
// Draw the 2nd graph
$DataSet->RemoveSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetYAxisName("Web Hits");
$Test->drawRightScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 213, 217, 221, TRUE, 0, 0);
示例6: _createVisitsGraph
protected function _createVisitsGraph()
{
// load pChart graphic library
$this->_loadLibs();
// définition des données à afficher
$dataSet = new pData();
// need config, to know which data user wants to display : visits, unique visitors, pageviews
$sefConfig = Sh404sefFactory::getConfig();
$dataTypeString = str_replace('ga:', '', $sefConfig->analyticsDashboardDataType);
// get data from response
$data = array();
$maxY = 0;
foreach ($this->_rawData['visits'] as $entry) {
$data[] = $entry->{$dataTypeString};
if ($entry->{$dataTypeString} > $maxY) {
$maxY = $entry->{$dataTypeString};
}
}
// format dates
$dates = Sh404sefHelperAnalytics::formatAbciseDates($this->_rawData['visits'], $this->_options);
$dataSet->AddPoint($data, $dataTypeString);
$dataSet->AddPoint($dates, "dates");
$dataSet->addSerie($dataTypeString);
$dataSet->SetAbsciseLabelSerie("dates");
$label = JText::_('COM_SH404SEF_ANALYTICS_DATA_' . strtoupper($dataTypeString));
$dataSet->SetSerieName($label, $dataTypeString);
// Initialise the graph
$w = $this->_options['cpWidth'];
$w = empty($w) ? 400 : intval($w - 40);
$h = 225;
$centreX = intval(0.5 * $w);
$centreY = intval(0.5 * $h);
$chart = new pChart($w, $h);
$fontSize = 8;
// calculate left margin based on max value to display
$leftMargin = 20 + $fontSize + 20 + $fontSize * strlen($maxY);
$bottomMargin = 5 + $fontSize * 6;
switch ($this->_options['groupBy']) {
case 'ga:year,ga:month,ga:week,ga:day':
$YAxisName = JText::_('Day');
break;
// date string represents a week number
// date string represents a week number
case 'ga:year,ga:month,ga:week':
$YAxisName = JText::_('Week');
break;
case 'ga:year,ga:month':
$YAxisName = JText::_('Month');
break;
}
$dataSet->SetYAxisName($label . JText::_('COM_SH404SEF_ANALYTICS_REPORT_PER_LABEL') . $YAxisName);
$chart->setFontProperties($this->_baseChartPath . DS . 'Fonts/arial.ttf', $fontSize);
$chart->setGraphArea($leftMargin, 30, $w - 20, $h - $bottomMargin);
$chart->drawFilledRoundedRectangle(7, 7, $w - 7, $h - 7, 5, 240, 240, 240);
$chart->drawRoundedRectangle(5, 5, $w - 5, $h - 5, 5, 230, 230, 230);
$chart->drawGraphArea(255, 255, 255, TRUE);
$d = $dataSet->GetData();
if (!empty($d)) {
$chart->drawScale($d, $dataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 60, 0, false);
$chart->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$chart->setFontProperties($this->_baseChartPath . DS . 'Fonts/arial.ttf', $fontSize);
$chart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the line graph
$chart->drawLineGraph($d, $dataSet->GetDataDescription());
$chart->drawPlotGraph($d, $dataSet->GetDataDescription(), 3, 2, 255, 255, 255);
}
// create a temporary file for
$user =& JFactory::getUser();
// make sure the root tmp dir exists
$rootDir = 'tmp' . DS . 'sh404sef_analytics';
Sh404sefHelperFiles::createDirAndIndex(JPATH_ROOT . DS . $rootDir);
// file name is per user
$basePath = $rootDir . DS . md5('useless_' . $user->id . '_hashing') . DS;
// create path and make sure there's an index.html file in it
Sh404sefHelperFiles::createDirAndIndex(JPATH_ROOT . DS . $basePath);
$imageFileName = Sh404sefHelperAnalytics::createTempFile($basePath, $this->_options['report'] . '.' . $this->_options['accountId'] . '.visits.' . $dataTypeString);
$chart->Render(JPATH_ROOT . DS . $imageFileName);
// need cleaning up, so let's remove all report files for that user older than an hour or so
Sh404sefHelperAnalytics::cleanReportsImageFiles(JPATH_ROOT . DS . $basePath, $age = 4000);
return JURI::root() . $imageFileName;
}
示例7: pData
*/
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
// $DataSet->AddPoint(array(10,9.4,7.7,5,1.7,-1.7,-5,-7.7,-9.4,-10,-9.4,-7.7,-5,-1.8,1.7),"Serie1");
// $DataSet->AddPoint(array(0,3.4,6.4,8.7,9.8,9.8,8.7,6.4,3.4,0,-3.4,-6.4,-8.6,-9.8,-9.9),"Serie2");
$DataSet->AddPoint(array(7.1, 9.1, 10, 9.699999999999999, 8.199999999999999, 5.7, 2.6, -0.9, -4.2, -7.1, -9.1, -10, -9.699999999999999, -8.199999999999999, -5.8), "Serie3");
// $DataSet->AddPoint(array("Jan","Jan","Jan","Feb","Feb","Feb","Mar","Mar","Mar","Apr","Apr","Apr","May","May","May"),"Serie4");
$DataSet->AddAllSeries();
// $DataSet->SetAbsciseLabelSerie("Serie4");
// $DataSet->SetSerieName("Max Average","Serie1");
// $DataSet->SetSerieName("Min Average","Serie2");
$DataSet->SetSerieName("Temperature", "Serie3");
$DataSet->SetYAxisName("Kg");
$DataSet->SetXAxisName("week");
// Initialise the graph
$Test = new pChart(600, 230);
$Test->reportWarnings("GD");
$Test->setFixedScale(-12, 13, 5);
//
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(65, 20, 570, 185);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 243, 249, 249);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(243, 249, 249, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE, 3);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
// $Test->setFontProperties("Fonts/tahoma.ttf",6);
示例8: pData
$data_count++;
});
$performance = number_format(round(($points[count($points) - 1] / $points[0] - 1) * 100, 2), 2, ',', '');
// Dataset definition
// File
$FileName = './tmp/' . md5($user['name']) . ".png";
// Graph
$DataSet = new pData();
$DataSet->AddPoint($points, "points");
$DataSet->AddPoint($rank, "rank");
$DataSet->AddPoint($time, "time");
$DataSet->AddSerie("points");
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("Punkte", "points");
$DataSet->SetSerieName("Rank", "rank");
$DataSet->SetYAxisName("Punkte");
$DataSet->SetAbsciseLabelSerie("time");
//$DataSet->SetXAxisFormat("date");
// Cache definition
$Cache = new pCache('../charts/Cache/');
if ($use_cache && !$Cache->GetFromCache(md5($user['name']), $DataSet->GetData(), $FileName) or !$use_cache) {
// Initialise the graph
$Test = new pChart(715, 230);
$Test->setDateFormat('d.m H:i');
$Test->setFontProperties("../charts/Fonts/tahoma.ttf", 8);
$Test->setGraphArea(60, 30, 650, 150);
$Test->drawFilledRoundedRectangle(7, 7, 708, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 710, 225, 5, 163, 203, 167);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawGraphAreaGradient(163, 203, 167, 50);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_DIFF, 150, 150, 150, TRUE, 75, 0, FALSE, $skip_scale);
示例9: get_teachers_information_graph
/**
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html
*/
public function get_teachers_information_graph()
{
$teachers = $this->teachers;
$graph = '';
$user_ids = array_keys($teachers);
$a_last_week = get_last_week();
if (is_array($user_ids) && count($user_ids) > 0) {
$data_set = new pData();
foreach ($user_ids as $user_id) {
$teacher_info = api_get_user_info($user_id);
$username = $teacher_info['username'];
$time_by_days = array();
foreach ($a_last_week as $day) {
// day is received as y-m-d 12:00:00
$start_date = api_get_utc_datetime($day);
$end_date = api_get_utc_datetime($day + (3600 * 24 - 1));
$time_on_platform_by_day = Tracking::get_time_spent_on_the_platform($user_id, 'custom', $start_date, $end_date);
$hours = floor($time_on_platform_by_day / 3600);
$min = floor(($time_on_platform_by_day - $hours * 3600) / 60);
$time_by_days[] = $min;
}
$data_set->AddPoint($time_by_days, $username);
$data_set->AddSerie($username);
}
$last_week = date('Y-m-d', $a_last_week[0]) . ' ' . get_lang('To') . ' ' . date('Y-m-d', $a_last_week[6]);
$days_on_week = array();
foreach ($a_last_week as $weekday) {
$days_on_week[] = date('d/m', $weekday);
}
$data_set->AddPoint($days_on_week, "Days");
$data_set->SetXAxisName($last_week);
$data_set->SetYAxisName(get_lang('Minutes'));
$data_set->SetAbsciseLabelSerie("Days");
$graph_id = $this->user_id . 'TeacherConnectionsGraph';
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
} else {
// Initializing the graph
$bg_width = 440;
$bg_height = 350;
$test = new pChart($bg_width + 10, $bg_height + 20);
$test->setFontProperties(api_get_path(LIBRARY_PATH) . 'pchart/fonts/tahoma.ttf', 8);
$test->setGraphArea(65, 30, $bg_width - 70, $bg_height - 50);
$test->drawFilledRoundedRectangle(7, 7, $bg_width, $bg_height, 5, 240, 240, 240);
$test->drawRoundedRectangle(5, 5, $bg_width + 2, $bg_height + 2, 5, 230, 230, 230);
$test->drawGraphArea(255, 255, 255, TRUE);
$test->drawScale($data_set->GetData(), $data_set->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
$test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Drawing lines
//$test->drawLineGraph($data_set->GetData(),$data_set->GetDataDescription());
$test->drawFilledCubicCurve($data_set->GetData(), $data_set->GetDataDescription(), 0.1, 30);
//$test->drawPlotGraph($data_set->GetData(),$data_set->GetDataDescription(),3,2,255,255,255);
// Drawing Legend
$test->setFontProperties(api_get_path(LIBRARY_PATH) . 'pchart/fonts/tahoma.ttf', 8);
$test->drawLegend($bg_width - 80, 20, $data_set->GetDataDescription(), 204, 204, 255);
$test->writeValues($data_set->GetData(), $data_set->GetDataDescription(), array("Days"));
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}
if (!empty($img_file)) {
$graph = '<img src="' . api_get_path(WEB_ARCHIVE_PATH) . $img_file . '">';
}
} else {
$graph = '<p>' . api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8') . '</p>';
}
return $graph;
}
示例10: componentLineGraph
public function componentLineGraph()
{
$DataSet = new pData();
$maxvals = array();
foreach ($this->datasets as $ds_id => $dataset) {
$DataSet->AddPoint($dataset['values'], "Serie" . $ds_id, array_keys($dataset['values']));
$maxvals[] = max($dataset['values']);
if (isset($dataset['burndown'])) {
$amount = count($dataset['values']) > 1 ? $dataset['burndown']['maxEstimation'] / (count($dataset['values']) - 1) : 0;
for ($i = 0; $i < count($dataset['values']); $i++) {
$burndownValues[] = $dataset['burndown']['maxEstimation'] - $i * $amount;
}
$DataSet->AddPoint($burndownValues, "Burndown" . $ds_id, $dataset['burndown']['maxEstimation']);
}
}
$DataSet->AddAllSeries();
if (isset($this->labels)) {
$DataSet->AddPoint($this->labels, "Labels");
$DataSet->SetAbsciseLabelSerie("Labels");
} else {
$DataSet->SetAbsciseLabelSerie();
}
foreach ($this->datasets as $ds_id => $dataset) {
$DataSet->SetSerieName($dataset['label'], "Serie" . $ds_id);
if (isset($dataset['burndown'])) {
$DataSet->SetSerieName($dataset['burndown']['label'], "Burndown" . $ds_id);
}
}
if (isset($this->values_title)) {
$DataSet->SetYAxisName($this->values_title);
}
if (isset($this->labels_title)) {
$DataSet->SetXAxisName($this->labels_title);
}
// Initialise the graph
$Test = new pChart($this->width, $this->height);
$Test->setFixedScale(0, ceil(max($maxvals) / 5) * 5);
$Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 8);
if (isset($this->labels_title)) {
$Test->setGraphArea(50, 30, $this->width - 30, $this->height - 45);
} else {
$Test->setGraphArea(50, 30, $this->width - 30, $this->height - 30);
}
$Test->drawFilledRoundedRectangle(2, 2, $this->width - 3, $this->height - 3, 5, 240, 240, 240);
$Test->drawRoundedRectangle(0, 0, $this->width - 1, $this->height - 1, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the cubic curve graph
if (isset($this->style) && $this->style == 'curved') {
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
} elseif (isset($this->style) && $this->style == 'filled_line') {
$Test->drawFilledLineGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 50, true);
} elseif (isset($this->style) && $this->style == 'stacked_bar') {
$Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 50, true);
} elseif (isset($this->style) && $this->style == 'single_bar') {
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
} else {
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
}
if (isset($this->include_plotter) && $this->include_plotter) {
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
}
// Finish the graph
$Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 8);
//$Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->drawLegend(55, 35, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSansBold.ttf', 10);
$Test->drawTitle(50, 22, $this->title, 50, 50, 50, $this->width - 30);
$Test->Stroke();
//("example2.png");
}
示例11: pData
include "src/pData.php";
include "src/pChart.php";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(1, 2, 5), "Serie1");
$DataSet->AddPoint(array(3, 2, 2), "Serie2");
$DataSet->AddPoint(array(3, 4, 1), "Serie3");
$DataSet->AddPoint(array("A#~1", "A#~2", "A#~3"), "Labels");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("Labels");
$DataSet->SetAbsciseLabelSerie("Labels");
$DataSet->SetSerieName("Alpha", "Serie1");
$DataSet->SetSerieName("Beta", "Serie2");
$DataSet->SetSerieName("Gama", "Serie3");
$DataSet->SetXAxisName("Samples IDs");
$DataSet->SetYAxisName("Test Marker");
$DataSet->SetYAxisUnit("µm");
// Initialise the graph
$Test = new pChart(380, 400);
$Test->drawGraphAreaGradient(90, 90, 90, 90, TARGET_BACKGROUND);
// Graph area setup
$Test->setFontProperties("Fonts/pf_arma_five.ttf", 6);
$Test->setGraphArea(110, 180, 350, 360);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALLSTART0, 213, 217, 221, TRUE, 0, 2, TRUE);
$Test->drawGraphAreaGradient(40, 40, 40, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 5);
// Draw the title
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Title = " Average growth size for selected\r\n DNA samples ";
$Test->setLineStyle(2);
示例12: pData
/*
Example1 : A simple line chart
*/
// Standard inclusions
include "src/pData.php";
include "src/pChart.php";
// Dataset definition
$DataSet = new pData();
$DataSet->ImportFromCSV("Sample/bulkdata.csv", ",", array(1, 2, 3), FALSE, 0);
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
$DataSet->SetSerieName("March", "Serie3");
$DataSet->SetYAxisName("Average age");
$DataSet->SetYAxisUnit("µs");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("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($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
$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
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
示例13: pchartAction
public function pchartAction()
{
// $this->_helper->layout->disableLayout();
$this->_helper->layout->setLayout("layout_admin");
include "pData.class";
include "pChart.class";
$this->view->showArray = $this->testdemoAction();
$showdate = array();
$showreport = array();
foreach ($this->view->showArray as $show) {
array_push($showdate, substr($show['date'], strlen($show['date']) - 4, 4));
array_push($showreport, $show['count']);
}
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array_slice($showreport, 0, 26), "Serie1");
$DataSet->AddPoint(array_slice($showdate, 0, 26), "Serie2");
$DataSet->AddSerie("Serie1");
$DataSet->SetAbsciseLabelSerie("Serie2");
$DataSet->SetSerieName("Reports", "Serie1");
$DataSet->SetYAxisName('Report Count');
$DataSet->SetXAxisName('Date');
// Initialise the graph
$Test = new pChart(900, 250);
$Test->setFontProperties("xihei.ttf", 8);
$Test->setGraphArea(50, 30, 780, 200);
$Test->drawFilledRoundedRectangle(7, 7, 793, 248, 5, 255, 255, 255);
$Test->drawRoundedRectangle(5, 5, 795, 249, 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("xihei.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("xihei.ttf", 8);
$Test->drawLegend(596, 50, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("xihei.ttf", 10);
$Test->drawTitle(200, 22, "Reports by Day in Jue.", 50, 50, 50, 585);
$Test->Render("Naked1.png");
//=====================================================================================
// Dataset definition
$DataSet2 = new pData();
$DataSet2->AddPoint(array(38, 22, 606), "Serie1");
$DataSet2->AddPoint(array("Male", "Female", "Unkown"), "Serie2");
$DataSet2->AddAllSeries();
$DataSet2->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$Test2 = new pChart(300, 200);
$Test2->loadColorPalette("softtones.txt");
$Test2->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 255, 255, 255);
$Test2->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
// This will draw a shadow under the pie chart
$Test2->drawFilledCircle(122, 102, 70, 200, 200, 200);
// Draw the pie chart
$Test2->setFontProperties("tahoma.ttf", 8);
$Test2->drawBasicPieGraph($DataSet2->GetData(), $DataSet2->GetDataDescription(), 120, 100, 70, PIE_PERCENTAGE, 255, 255, 218);
$Test2->drawPieLegend(230, 15, $DataSet2->GetData(), $DataSet2->GetDataDescription(), 250, 250, 250);
$Test2->Render("Naked2.png");
//=====================================================================================
// select province
$db = Zend_Registry::get('db');
$selectprovince = $db->select();
$selectprovince->from('consumer', array("province", "count(*) as count"))->where("pest is null")->group("consumer.province")->order("count desc");
$provinceArray = $db->fetchAll($selectprovince);
$this->view->showprovince = '';
$this->view->showprovincecount = '';
$showprovince = array();
$showprovincecount = array();
foreach ($provinceArray as $province) {
if ($province['province'] == null || $province['province'] == '') {
array_push($showprovince, 'Unkown');
} else {
array_push($showprovince, $province['province']);
}
array_push($showprovincecount, $province['count']);
}
// Dataset definition
$DataSet3 = new pData();
$DataSet3->AddPoint(array_slice($showprovincecount, 0, 20), "Serie1");
$DataSet3->AddPoint(array_slice($showprovince, 0, 20), "Serie2");
$DataSet3->AddSerie("Serie1");
$DataSet3->SetAbsciseLabelSerie("Serie2");
$DataSet3->SetSerieName("Spark Count", "Serie1");
$DataSet3->SetYAxisName('Spark Count');
$DataSet3->SetXAxisName('Province');
Zend_Debug::dump($DataSet3->GetDataDescription());
// Initialise the graph
$Test3 = new pChart(900, 250);
$Test3->setFontProperties("xihei.ttf", 8);
$Test3->setGraphArea(50, 30, 780, 200);
$Test3->drawFilledRoundedRectangle(7, 7, 793, 248, 5, 255, 255, 255);
$Test3->drawRoundedRectangle(5, 5, 795, 249, 5, 230, 230, 230);
$Test3->drawGraphArea(255, 255, 255, TRUE);
$Test3->drawScale($DataSet3->GetData(), $DataSet3->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test3->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test3->setFontProperties("xihei.ttf", 6);
//.........这里部分代码省略.........
示例14: array
require 'DB.php';
require 'graphfunc.php';
$name = $_GET['name'];
preg_replace("/[^A-Za-z0-9 ]/", '', $name);
$db = DB::connect("mysql://roland:68volvo@localhost/games");
$sql = "select games.date, elo.elo from elo inner join games on games.gameid = elo.gameid where elo.name = '{$name}' order by elo.eloid asc";
$q = $db->query($sql);
$date = array();
$val = array();
$year = 0;
while ($q->fetchInto($row)) {
if ($year != toYStr($row[0])) {
$date[] = toYStr($row[0]);
} else {
$date[] = "";
}
$year = toYStr($row[0]);
$val[] = $row[1];
}
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($val, "Serie1");
$DataSet->AddPoint($date, "Serie2");
$DataSet->AddSerie("Serie1");
$DataSet->SetAbsciseLabelSerie("Serie2");
$DataSet->SetYAxisName("ELO");
$DataSet->SetXAxisName("Game");
drawChart($title, $DataSet, "line", array(array(255, 0, 0)));
示例15: pData
<?php
/*
Example16 : Importing CSV data
*/
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->ImportFromCSV("Sample/CO2.csv", ",", array(1, 2, 3, 4), TRUE, 0);
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetYAxisName("CO2 concentrations");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->reportWarnings("GD");
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(60, 30, 680, 180);
$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, 90, 2);
$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
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Finish the graph