本文整理汇总了PHP中Chart类的典型用法代码示例。如果您正苦于以下问题:PHP Chart类的具体用法?PHP Chart怎么用?PHP Chart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Chart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFromResponse
public static function createFromResponse(\SimpleXMLElement $response)
{
$chart = new Chart();
$chart->setFrom((int) $response->attributes()->from);
$chart->setTo((int) $response->attributes()->to);
return $chart;
}
示例2: getChart
/**
* @return Chart
*/
public static function getChart($cate)
{
/** @var Chart $chart */
$chart = new Chart();
$db = DB::getConn();
$stm = $db->prepare('select uid, cate, ans from Answers where cate=:cate');
$stm->bindParam(':cate', $cate);
$stm->execute();
$rs = $stm->fetchAll();
$legends = [];
foreach ($rs as $r) {
$results = QuestionCtrl::getResByID($r['uid'], $r['cate']);
$mark = 0;
$total = 0;
foreach ($results as $result) {
$total += $result->getPoint();
$mark += $result->getMark();
}
if ($total != 0) {
$legends[] = number_format($mark * 100 / $total, 1, '.', ',');
}
}
$chart->setLegends($legends);
return $chart;
}
示例3: execute
public function execute($type_report = '', $id_report = '')
{
$selected_id = ($type_report == "grafico" ? "chart_" : "report_") . $id_report;
$this->showDashboard($selected_id);
switch ($type_report) {
case "relatorio":
include "Report.php";
$obj = new Report($id_report);
break;
case "grafico":
include "Chart.php";
$obj = new Chart($id_report);
break;
}
$obj->execute();
}
示例4: init
public function init()
{
parent::init();
$dataTable = $this->dataTable();
$jOpts = self::encode($this->options);
$id = $this->getId();
$this->getView()->registerJs("var {$id}=new google.visualization.PieChart(document.getElementById('{$id}'));{$id}.draw({$dataTable},{$jOpts});");
}
示例5: initChart
/**
* load jsapi
*/
private function initChart()
{
self::$_first = false;
$output = '';
// start a code block
$output .= '<script type="text/javascript" src="https://www.google.com/jsapi"></script>' . "\n";
$output .= '<script type="text/javascript">google.load(\'visualization\', \'1.0\', {\'packages\':[\'corechart\']});</script>' . "\n";
return $output;
}
示例6: __construct
public function __construct($width, $height)
{
if ($width > self::MAX_WIDTH) {
throw new InvalidArgumentException(sprintf('Max width for Map Chart is %d.', self::MAX_WIDTH));
}
if ($height > self::MAX_HEIGHT) {
throw new InvalidArgumentException(sprintf('Max height for Map Chart is %d.', self::MAX_HEIGHT));
}
parent::__construct('t', $width, $height);
}
示例7: actionIndex
public function actionIndex()
{
$active_user = User::require_active_user();
$this->setLayoutVar('active_user', $active_user);
$this->setVar('active_user', $active_user);
$this->setLayoutVar('pageTitle', 'Charts');
$this->setLayoutVar('pageHead', 'Charts');
$most_snatched = Chart::most_snatched(array('limit' => 10));
$top_uploaders = Chart::top_uploaders(array('limit' => 10, 'user' => $active_user));
$this->setVar('most_snatched', $most_snatched);
$this->setVar('top_uploaders', $top_uploaders);
}
示例8: showPage
public function showPage($selected = '')
{
if (!FUTURI_Session::isUserAdmin()) {
$this->load->view("nopermission_admin");
}
$this->load->view("admin_header", array('selected' => $selected));
switch ($selected) {
case "usuarios":
include "application/controllers/User.php";
define_constants();
$userController = new User();
$userController->showListPage('', 10, false);
break;
case "estatisticas":
break;
case "backups":
include "application/controllers/Backup.php";
define_constants();
$backupController = new Backup();
$backupController->showListPage('', 10, false);
break;
case "configs":
$this->load->view("admin_configs", array("object_handler" => $this));
break;
case "relatorios":
include "application/controllers/Report.php";
define_constants();
$reportController = new Report();
$reportController->showListPage('', 10, false);
break;
case "graficos":
include "application/controllers/Chart.php";
define_constants();
$chartController = new Chart();
$chartController->showListPage('', 10, false);
break;
}
}
示例9: clearAllReferences
/**
* Resets all references to other model objects or collections of model objects.
*
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volumne/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
if ($this->aUser instanceof Persistent) {
$this->aUser->clearAllReferences($deep);
}
if ($this->aChart instanceof Persistent) {
$this->aChart->clearAllReferences($deep);
}
$this->alreadyInClearAllReferencesDeep = false;
}
// if ($deep)
$this->aUser = null;
$this->aChart = null;
}
示例10: init
public function init()
{
parent::init();
$dataTable = $this->dataTable();
$jOpts = self::encode($this->options);
$id = $this->getId();
if ($this->mode == 'classic') {
$package = 'corechart';
$call = "var {$id}=new google.visualization.ColumnChart(document.getElementById('{$id}'));{$id}.draw({$dataTable},{$jOpts});";
} else {
$package = 'bar';
if ($this->mode == 'transition') {
$jOpts = "google.charts.Bar.convertOptions({$jOpts})";
}
$call = "var {$id}=new google.charts.Bar(document.getElementById('{$id}'));{$id}.draw({$dataTable},{$jOpts});";
}
$this->packages = [$package];
$this->getView()->registerJs($call);
}
示例11: report
public function report()
{
// // Group IQs by gender
// $genderIQs = array();
// foreach ($this->_humans as $human) {
// if ($human instanceof Human) {
// $genderIQs[$human->getGender()][] = $human->getIQ();
// }
// }
// // Output gender IQ distribution
// foreach ($genderIQs as $gender => $iQs) {
// echo $gender . ': ' . count($iQs) . "\n";
// echo Chart::output(self::IQ_INIT_BASE - self::IQ_INIT_VAR, self::IQ_INIT_BASE + self::IQ_INIT_VAR, 5, $iQs);
// }
$iQs = array();
foreach ($this->_humans as $human) {
$iQs[] = $human->getIQ();
}
echo 'Count: ' . count($iQs) . "\n";
echo Chart::output(self::IQ_INIT_BASE - self::IQ_INIT_VAR, self::IQ_INIT_BASE + self::IQ_INIT_VAR, 5, $iQs);
}
示例12: buildGraph
/**
* @return Chart
*/
public function buildGraph()
{
$graph = new Chart($this->width, $this->height);
$graph->SetScale("datlin");
$graph->title->Set($this->title);
$graph->subtitle->Set($this->description);
$colors = $graph->getThemedColors();
$graph->xaxis->SetTickLabels($this->burndown_data->getHumanReadableDates());
$remaining_effort = new LinePlot($this->burndown_data->getRemainingEffort());
$remaining_effort->SetColor($colors[1] . ':0.7');
$remaining_effort->SetWeight(2);
$remaining_effort->SetLegend('Remaining effort');
$remaining_effort->mark->SetType(MARK_FILLEDCIRCLE);
$remaining_effort->mark->SetColor($colors[1] . ':0.7');
$remaining_effort->mark->SetFillColor($colors[1]);
$remaining_effort->mark->SetSize(3);
$graph->Add($remaining_effort);
$ideal_burndown = new LinePlot($this->burndown_data->getIdealEffort());
$ideal_burndown->SetColor($colors[0] . ':1.25');
$ideal_burndown->SetLegend('Ideal Burndown');
$graph->Add($ideal_burndown);
return $graph;
}
示例13: Chart
<?php
require '../lib/Chart.php';
$chart = new Chart('lc', 500, 200);
$chart->setScale(0, 100);
$line = new ChartData(array(10, 12, 15, 20, 22, 50, 60, 63, 58, 75, 67, 80));
$chart->addData($line);
$y_axis = new ChartAxis('y');
$chart->addAxis($y_axis);
$x_axis = new ChartAxis('x');
$chart->addAxis($x_axis);
if (isset($_GET['debug'])) {
var_dump($chart->getQuery());
echo $chart->validate();
echo $chart->toHtml();
} else {
header('Content-Type: image/png');
echo $chart;
}
示例14: include_library
/**
*
* get the JS library that we need to generate charts
* @param boolean $force forces the inclusion
* @return string
*/
public static function include_library($force = FALSE)
{
if (self::$included_lib == FALSE or $force == TRUE) {
self::$included_lib = TRUE;
return HTML::script((Core::is_HTTPS() ? 'https:' : 'http:') . '//www.google.com/jsapi') . PHP_EOL;
}
return FALSE;
}
示例15: __construct
/**
* @param string $title The main title of the error. eg: "Unable to render the chart"
* @param string $msg The error message full of details
* @param int $aWidth The width of the image (this forces the text to wrap)
* /!\ A too small width may lead to a jpgraph error
* @param int $aHeight The height of the image
* /!\ A too small width may lead to a jpgraph error
*/
public function __construct($title, $msg, $aWidth = 600, $aHeight = 400)
{
parent::__construct($aWidth, $aHeight);
$this->img_width = $aWidth;
$this->jpgraph_instance->InitFrame();
$padding = 10;
$graph_title = $this->addTextToGraph($title, $padding, $padding, FS_BOLD, 12, $aWidth);
$height = $graph_title->GetTextHeight($this->jpgraph_instance->img);
$text = $this->addTextToGraph($msg, $padding, 2 * $padding + $height, FS_NORMAL, 8, $aWidth);
}