本文整理汇总了PHP中JpGraphError类的典型用法代码示例。如果您正苦于以下问题:PHP JpGraphError类的具体用法?PHP JpGraphError怎么用?PHP JpGraphError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JpGraphError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mydie
function mydie($errno, $errstr = '', $errfile = '', $errline = '')
{
global $conf;
$jpgraph = $conf->get_conf('jpgraph_path');
include_once "{$jpgraph}/jpgraph.php";
$err = $errstr ? $errstr : $errno;
if ($errfile) {
switch ($errno) {
case 1:
$errprefix = 'Error';
break;
case 2:
$errprefix = 'Warning';
break;
case 8:
$errprefix = 'Notice';
break;
default:
return;
// dont show E_STRICT errors
}
$err = "{$errprefix}: {$err} in '{$errfile}' line {$errline}";
}
$error = new JpGraphError();
$error->Raise($err);
echo "{$err}";
exit;
}
示例2: Stroke
function Stroke(&$img, &$xscale, &$yscale)
{
$numpoints = count($this->coords[0]) / 2;
$img->SetColor($this->color);
$img->SetLineWeight($this->weight);
if (isset($this->coords[1])) {
if (count($this->coords[1]) != $numpoints) {
JpGraphError::Raise("Number of X and Y points are not equal. Number of X-points:" . count($this->coords[1]) . " Number of Y-points:{$numpoints}");
} else {
$exist_x = true;
}
} else {
$exist_x = false;
}
if ($exist_x) {
$xs = $this->coords[1][0];
} else {
$xs = 0;
}
for ($i = 0; $i < $numpoints; ++$i) {
if ($exist_x) {
$x = $this->coords[1][$i];
} else {
$x = $i;
}
$xt = $xscale->Translate($x);
$yt1 = $yscale->Translate($this->coords[0][$i * 2]);
$yt2 = $yscale->Translate($this->coords[0][$i * 2 + 1]);
$img->Line($xt, $yt1, $xt, $yt2);
$img->Line($xt - $this->errwidth, $yt1, $xt + $this->errwidth, $yt1);
$img->Line($xt - $this->errwidth, $yt2, $xt + $this->errwidth, $yt2);
}
return true;
}
示例3: __construct
public function __construct($errcode, $a1 = null, $a2 = null, $a3 = null, $a4 = null, $a5 = null)
{
// make sure everything is assigned properly
$errtxt = new ErrMsgText();
JpGraphError::SetTitle('JpGraph Error: ' . $errcode);
parent::__construct($errtxt->Get($errcode, $a1, $a2, $a3, $a4, $a5), 0);
}
示例4: GetCodewords
function GetCodewords($aData, $aLevel = 1)
{
$n = count($aData);
if ($n == 0) {
JpGraphError::RaiseL(25014);
}
//'No data to calculate codewords on.');
$k = 1 << $aLevel + 1;
$ck = array();
$m = 929;
for ($i = 0; $i < $k; ++$i) {
$ck[$i] = 0;
}
$t1 = $t2 = 0;
for ($i = 0; $i < $n; ++$i) {
$t1 = ($aData[$i] + $ck[$k - 1]) % $m;
for ($j = $k - 1; $j > 0; --$j) {
$t2 = $t1 * $this->iPolCoeff[$aLevel][$j] % $m;
$ck[$j] = ($ck[$j - 1] + ($m - $t2)) % $m;
}
$t2 = $t1 * $this->iPolCoeff[$aLevel][0] % $m;
$ck[0] = ($m - $t2) % $m;
}
for ($i = 0; $i < $k; ++$i) {
if ($ck[$i] > 0) {
$ck[$i] = $m - $ck[$i];
}
}
return array_reverse($ck);
}
示例5: GetPattern
function GetPattern($aRow, $aCodeVal)
{
if (empty($this->iPatterns[$aRow % 3 * 3][$aCodeVal])) {
JpGraphError::RaiseL(26007, $aCodeVal, $aRow);
}
//"GetPattern: Illegal Code Value = $aCodeVal (row=$aRow)\n\n");
return $this->iPatterns[$aRow % 3 * 3][$aCodeVal];
}
示例6: SetType
function SetType($aType, $aFileName = '', $aScale = 1.0)
{
$this->type = $aType;
if ($aType == MARK_IMG && $aFileName == '') {
JpGraphError::RaiseL(23003);
}
$this->iFileName = $aFileName;
$this->iScale = $aScale;
}
示例7: ScatterPlot
function ScatterPlot(&$datay, $datax = false)
{
if (count($datax) != count($datay) && is_array($datax)) {
JpGraphError::Raise("Scatterplot must have equal number of X and Y points.");
}
$this->Plot($datay, $datax);
$this->mark = new PlotMark();
$this->mark->SetType(MARK_CIRCLE);
$this->mark->SetColor($this->color);
}
示例8: execute
function execute()
{
$this->set_title($this->lang->stats);
$this->tree($this->lang->stats);
include '../lib/jpgraph/jpgraph.php';
include '../lib/jpgraph/jpgraph_bar.php';
if (!defined('IMG_PNG')) {
JpGraphError::Raise("This PHP installation is not configured with PNG support. Please recompile PHP with GD and JPEG support to run JpGraph. (Constant IMG_PNG does not exist)");
}
/**
* Posts
*/
$query = $this->db->query("SELECT COUNT(post_id) AS posts, FROM_UNIXTIME(post_time, '%%b %%y') AS month\n\t\t\tFROM %pposts GROUP BY month\tORDER BY post_time");
$data = array();
while ($item = $this->db->nqfetch($query)) {
$data[$item['month']] = $item['posts'];
}
if (!$data) {
$data = array(0, 0);
}
$graph = new Graph(400, 300, 'auto');
$graph->SetScale('textint');
$graph->SetColor('aliceblue');
$graph->SetMarginColor('white');
$graph->xaxis->SetTickLabels(array_keys($data));
$graph->yaxis->scale->SetGrace(20);
$graph->title->Set($this->lang->stats_post_by_month);
$temp = array_values($data);
$barplot = new BarPlot($temp);
$barplot->SetFillColor('darkorange');
$graph->add($barplot);
$graph->Stroke("../stats/{$this->time}1.png");
/**
* Registrations
*/
$query = $this->db->query("SELECT COUNT(user_id) AS users, FROM_UNIXTIME(user_joined, '%%b %%y') AS month\n\t\t\tFROM %pusers\n\t\t\tWHERE user_joined != 0\n\t\t\tGROUP BY month\n\t\t\tORDER BY user_joined");
$data = array();
while ($item = $this->db->nqfetch($query)) {
$data[$item['month']] = $item['users'];
}
$graph = new Graph(400, 300, 'auto');
$graph->SetScale('textint');
$graph->SetColor('aliceblue');
$graph->SetMarginColor('white');
$graph->xaxis->SetTickLabels(array_keys($data));
$graph->yaxis->scale->SetGrace(20);
$graph->title->Set($this->lang->stats_reg_by_month);
$temp = array_values($data);
$barplot = new BarPlot($temp);
$barplot->SetFillColor('darkorange');
$graph->add($barplot);
$graph->Stroke("../stats/{$this->time}2.png");
return $this->message($this->lang->stats, "<img src='../stats/{$this->time}1.png' alt='{$this->lang->stats_post_by_month}' /><br /><br />\n\t\t<img src='../stats/{$this->time}2.png' alt='{$this->lang->stats_reg_by_month}' />");
}
示例9: Translate
function Translate($a)
{
if ($a < 0) {
JpGraphError::Raise("Negative data values can not be used in a log scale.");
exit(1);
}
if ($a == 0) {
$a = 1;
}
$a = log10($a);
return floor($this->off + ($a * 1.0 - $this->scale[0]) * $this->scale_factor);
}
示例10: Stroke
public function Stroke()
{
if (JpGraphError::GetImageFlag()) {
$errobj = new JpGraphErrObjectImg();
$errobj->SetTitle(JpGraphError::GetTitle());
} else {
$errobj = new JpGraphErrObject();
$errobj->SetTitle(JpGraphError::GetTitle());
$errobj->SetStrokeDest(JpGraphError::GetLogFile());
}
$errobj->Raise($this->getMessage());
}
示例11: ApplyGraph
/**
*
*/
function ApplyGraph($graph)
{
$this->graph = $graph;
$method_name = '';
if (get_class($graph) == 'Graph') {
$method_name = 'SetupGraph';
} else {
$method_name = 'Setup' . get_class($graph);
}
if (method_exists($this, $method_name)) {
$this->{$method_name}($graph);
} else {
JpGraphError::RaiseL(30001, $method_name, $method_name);
//Theme::%s() is not defined. \nPlease make %s(\$graph) function in your theme classs.
}
}
示例12: File
function File($family, $style = FS_NORMAL)
{
$fam = @$this->font_files[$family];
if (!$fam) {
JpGraphError::RaiseL(25046, $family);
//("Specified TTF font family (id=$family) is unknown or does not exist. Please note that TTF fonts are not distributed with JpGraph for copyright reasons. You can find the MS TTF WEB-fonts (arial, courier etc) for download at http://corefonts.sourceforge.net/");
}
$ff = @$fam[$style];
// There are several optional file names. They are tried in order
// and the first one found is used
if (!is_array($ff)) {
$ff = array($ff);
}
$jpgraph_font_dir = dirname(__FILE__) . '/fonts/';
foreach ($ff as $font_file) {
// All font families are guaranteed to have the normal style
if ($font_file === '') {
JpGraphError::RaiseL(25047, $this->style_names[$style], $this->font_files[$family][FS_NORMAL]);
}
//('Style "'.$this->style_names[$style].'" is not available for font family '.$this->font_files[$family][FS_NORMAL].'.');
if (!$font_file) {
JpGraphError::RaiseL(25048, $fam);
//("Unknown font style specification [$fam].");
}
// check jpgraph/src/fonts dir
$jpgraph_font_file = $jpgraph_font_dir . $font_file;
if (file_exists($jpgraph_font_file) === true && is_readable($jpgraph_font_file) === true) {
$font_file = $jpgraph_font_file;
break;
}
// check OS font dir
if ($family >= FF_MINCHO && $family <= FF_PGOTHIC) {
$font_file = MBTTF_DIR . $font_file;
} else {
$font_file = TTF_DIR . $font_file;
}
if (file_exists($font_file) === true && is_readable($font_file) === true) {
break;
}
}
if (!file_exists($font_file)) {
JpGraphError::RaiseL(25049, $font_file);
//("Font file \"$font_file\" is not readable or does not exist.");
}
return $font_file;
}
示例13: GetImg
function GetImg($aMark, $aIdx)
{
$n = $this->an[$aMark];
if (is_string($aIdx)) {
if (!in_array($aIdx, $this->colors)) {
JpGraphError::RaiseL(23001, $this->name, $aIdx);
//('This marker "'.($this->name).'" does not exist in color: '.$aIdx);
}
$idx = $this->index[$aIdx];
} elseif (!is_integer($aIdx) || is_integer($aIdx) && $aIdx > $this->maxidx) {
JpGraphError::RaiseL(23002, $this->name);
//('Mark color index too large for marker "'.($this->name).'"');
} else {
$idx = $aIdx;
}
return Image::CreateFromString(base64_decode($this->{$n}[$idx][1]));
}
示例14: Convert
public function Convert($aTxt, $aFF)
{
if (LANGUAGE_GREEK) {
if (GREEK_FROM_WINDOWS) {
$unistring = LanguageConv::gr_win2uni($aTxt);
} else {
$unistring = LanguageConv::gr_iso2uni($aTxt);
}
return $unistring;
} elseif (LANGUAGE_CYRILLIC) {
if (CYRILLIC_FROM_WINDOWS && (!defined('LANGUAGE_CHARSET') || stristr(LANGUAGE_CHARSET, 'windows-1251'))) {
$aTxt = convert_cyr_string($aTxt, "w", "k");
}
if (!defined('LANGUAGE_CHARSET') || stristr(LANGUAGE_CHARSET, 'koi8-r') || stristr(LANGUAGE_CHARSET, 'windows-1251')) {
$isostring = convert_cyr_string($aTxt, "k", "i");
$unistring = LanguageConv::iso2uni($isostring);
} else {
$unistring = $aTxt;
}
return $unistring;
} elseif ($aFF === FF_SIMSUN) {
// Do Chinese conversion
if ($this->g2312 == null) {
include_once 'jpgraph_gb2312.php';
$this->g2312 = new GB2312toUTF8();
}
return $this->g2312->gb2utf8($aTxt);
} elseif ($aFF === FF_BIG5) {
if (!function_exists('iconv')) {
JpGraphError::RaiseL(25006);
//('Usage of FF_CHINESE (FF_BIG5) font family requires that your PHP setup has the iconv() function. By default this is not compiled into PHP (needs the "--width-iconv" when configured).');
}
return iconv('BIG5', 'UTF-8', $aTxt);
} elseif (ASSUME_EUCJP_ENCODING && ($aFF == FF_MINCHO || $aFF == FF_GOTHIC || $aFF == FF_PMINCHO || $aFF == FF_PGOTHIC)) {
if (!function_exists('mb_convert_encoding')) {
JpGraphError::RaiseL(25127);
}
return mb_convert_encoding($aTxt, 'UTF-8', 'EUC-JP');
} elseif ($aFF == FF_DAVID || $aFF == FF_MIRIAM || $aFF == FF_AHRON) {
return LanguageConv::heb_iso2uni($aTxt);
} else {
return $aTxt;
}
}
示例15: Bezier
function Bezier($datax, $datay, $attraction_factor = 1)
{
$this->n = count($datax);
if ($this->n !== count($datay)) {
JpGraphError::RaiseL(19003);
}
$idx = 0;
foreach ($datax as $datumx) {
for ($i = 0; $i < $attraction_factor; $i++) {
$this->datax[$idx++] = $datumx;
}
}
$idx = 0;
foreach ($datay as $datumy) {
for ($i = 0; $i < $attraction_factor; $i++) {
$this->datay[$idx++] = $datumy;
}
}
$this->n *= $attraction_factor;
}