当前位置: 首页>>代码示例>>PHP>>正文


PHP JpgraphError::Raise方法代码示例

本文整理汇总了PHP中JpgraphError::Raise方法的典型用法代码示例。如果您正苦于以下问题:PHP JpgraphError::Raise方法的具体用法?PHP JpgraphError::Raise怎么用?PHP JpgraphError::Raise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JpgraphError的用法示例。


在下文中一共展示了JpgraphError::Raise方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: StrokeCSIM

 function StrokeCSIM($aScriptName = '', $aCSIMName = '', $aBorder = 0)
 {
     global $_REQUEST;
     if ($aCSIMName == '') {
         // create a random map name
         srand((double) microtime() * 1000000);
         $r = rand(0, 100000);
         $aCSIMName = '__mapname' . $r . '__';
     }
     if (empty($_REQUEST[_CSIM_DISPLAY])) {
         // First determine if we need to check for a cached version
         // This differs from the standard cache in the sense that the
         // image and CSIM map HTML file is written relative to the directory
         // the script executes in and not the specified cache directory.
         // The reason for this is that the cache directory is not necessarily
         // accessible from the HTTP server.
         if ($this->csimcachename != '') {
             $dir = dirname($this->csimcachename);
             $base = basename($this->csimcachename);
             $base = strtok($base, '.');
             $suffix = strtok('.');
             $basecsim = $dir . '/' . $base . '_csim_.html';
             $baseimg = $base . '.' . $this->img->img_format;
             // Check that apache can write to directory specified
             if (file_exists($dir) && !is_writeable($dir)) {
                 JpgraphError::Raise('Apache/PHP does not have permission to write to the CSIM cache directory (' . $dir . '). Check permissions.');
             }
             // Make sure directory exists
             $this->cache->MakeDirs($dir);
             // Write the image file
             $this->Stroke(CSIMCACHE_DIR . $baseimg);
             // Construct wrapper HTML and write to file and send it back to browser
             $htmlwrap = $this->GetHTMLImageMap($aCSIMName) . "\n" . '<img src="' . CSIMCACHE_HTTP_DIR . $baseimg . '" ISMAP USEMAP="#' . $aCSIMName . '" border=' . $aBorder . '>' . "\n";
             if ($fh = @fopen($basecsim, 'w')) {
                 fwrite($fh, $htmlwrap);
                 fclose($fh);
                 echo $htmlwrap;
             } else {
                 JpGraphError::Raise(" Can't write CSIM \"{$basecsim}\" for writing. Check free space and permissions.");
             }
         } else {
             if ($aScriptName == '') {
                 JpGraphError::Raise('Missing script name in call to StrokeCSIM(). You must specify the name of the actual image script as the first parameter to StrokeCSIM().');
                 exit;
             }
             // Construct the HTML wrapper page
             // Get all user defined URL arguments
             reset($_REQUEST);
             // This is a JPGRAPH internal defined that prevents
             // us from recursively coming here again
             $urlarg = '?' . _CSIM_DISPLAY . '=1';
             while (list($key, $value) = each($_REQUEST)) {
                 if (is_array($value)) {
                     $n = count($value);
                     for ($i = 0; $i < $n; ++$i) {
                         $urlarg .= '&' . $key . '%5B%5D=' . urlencode($value[$i]);
                     }
                 } else {
                     $urlarg .= '&' . $key . '=' . urlencode($value);
                 }
             }
             echo $this->GetHTMLImageMap($aCSIMName);
             echo "<img src='" . $aScriptName . $urlarg . "' ISMAP USEMAP='#" . $aCSIMName . "' border={$aBorder}>";
         }
     } else {
         $this->Stroke();
     }
 }
开发者ID:hostellerie,项目名称:nexpro,代码行数:68,代码来源:jpgraph.php

示例2: AutoSize


//.........这里部分代码省略.........
                 // Depending on what format the user has choose we need different amount
                 // of space. We therefore create a typical string for the choosen format
                 // and determine the length of that string.
                 switch ($this->scale->minute->iStyle) {
                     case HOURSTYLE_CUSTOM:
                         $txt2 = date($this->scale->minute->iLabelFormStr, strtotime('2005-05-15 18:55'));
                         break;
                     case MINUTESTYLE_MM:
                     default:
                         $txt2 = '15';
                         break;
                 }
                 $mfw = $this->scale->minute->GetStrWidth($this->img, $txt2) + 6;
                 $n2 = ceil(60 / $this->scale->minute->GetIntervall());
                 $mw = $n2 * $mfw;
             }
             $hfw = $hfw < $mw ? $mw : $hfw;
             $n = ceil(24 * 60 / $this->scale->TimeToMinutes($this->scale->hour->GetIntervall()));
             $hw = $n * $hfw;
             $fw = $fw < $hw ? $hw : $fw;
         }
         // We need to repeat this code block here as well.
         // THIS iS NOT A MISTAKE !
         // We really need it since we need to adjust for minutes both in the case
         // where hour scale is shown and when it is not shown.
         if ($this->scale->IsDisplayMinute()) {
             // Depending on what format the user has choose we need different amount
             // of space. We therefore create a typical string for the choosen format
             // and determine the length of that string.
             switch ($this->scale->minute->iStyle) {
                 case HOURSTYLE_CUSTOM:
                     $txt = date($this->scale->minute->iLabelFormStr, strtotime('2005-05-15 18:55'));
                     break;
                 case MINUTESTYLE_MM:
                 default:
                     $txt = '15';
                     break;
             }
             $mfw = $this->scale->minute->GetStrWidth($this->img, $txt) + 6;
             $n = ceil(60 / $this->scale->TimeToMinutes($this->scale->minute->GetIntervall()));
             $mw = $n * $mfw;
             $fw = $fw < $mw ? $mw : $fw;
         }
         // If we display week we must make sure that 7*$fw is enough
         // to fit up to 10 characters of the week font (if the week is enabled)
         if ($this->scale->IsDisplayWeek()) {
             // Depending on what format the user has choose we need different amount
             // of space
             $fsw = strlen($this->scale->week->iLabelFormStr);
             if ($this->scale->week->iStyle == WEEKSTYLE_FIRSTDAY2WNBR) {
                 $fsw += 8;
             } elseif ($this->scale->week->iStyle == WEEKSTYLE_FIRSTDAYWNBR) {
                 $fsw += 7;
             } else {
                 $fsw += 4;
             }
             $ww = $fsw * $this->scale->week->GetFontWidth($this->img);
             if (7 * $fw < $ww) {
                 $fw = ceil($ww / 7);
             }
         }
         if (!$this->scale->IsDisplayDay() && !$this->scale->IsDisplayHour() && !(($this->scale->week->iStyle == WEEKSTYLE_FIRSTDAYWNBR || $this->scale->week->iStyle == WEEKSTYLE_FIRSTDAY2WNBR) && $this->scale->IsDisplayWeek())) {
             // If we don't display the individual days we can shrink the
             // scale a little bit. This is a little bit pragmatic at the
             // moment and should be re-written to take into account
             // a) What scales exactly are shown and
             // b) what format do they use so we know how wide we need to
             // make each scale text space at minimum.
             $fw /= 2;
             if (!$this->scale->IsDisplayWeek()) {
                 $fw /= 1.8;
             }
         }
         // Has the user specified a width or do we need to
         // determine it?
         if ($this->img->width <= 0) {
             // Now determine the width for the activity titles column
             // Firdst find out the maximum width of each object column
             $cw = $this->GetMaxActInfoColWidth();
             $this->scale->actinfo->SetMinColWidth($cw);
             $titlewidth = max(max($this->GetMaxLabelWidth(), $this->scale->tableTitle->GetWidth($this->img)), $this->scale->actinfo->GetWidth($this->img));
             // Add the width of the vertivcal divider line
             $titlewidth += $this->scale->divider->iWeight * 2;
             // Now get the total width taking
             // titlewidth, left and rigt margin, dayfont size
             // into account
             $width = $titlewidth + $nd * $fw + $lm + $rm;
         } else {
             $width = $this->img->width;
         }
         $width = round($width);
         $height = round($height);
         // Make a sanity check on image size
         if ($width > MAX_GANTTIMG_SIZE_W || $height > MAX_GANTTIMG_SIZE_H) {
             JpgraphError::Raise("Sanity check for automatic Gantt chart size failed. Either the width (={$width}) or height (={$height}) is larger than MAX_GANTTIMG_SIZE. This could potentially be caused by a wrong date in one of the activities.");
         }
         $this->img->CreateImgCanvas($width, $height);
         $this->img->SetMargin($lm, $rm, $tm, $bm);
     }
 }
开发者ID:jeromecc,项目名称:tuv2,代码行数:101,代码来源:jpgraph_gantt.php

示例3: GanttGraph

 function GanttGraph($aWidth = 0, $aHeight = 0, $aCachedName = "", $aTimeOut = 0, $aInline = true)
 {
     // Backward compatibility
     if ($aWidth == -1) {
         $aWidth = 0;
     }
     if ($aHeight == -1) {
         $aHeight = 0;
     }
     if ($aWidth < 0 || $aHeight < 0) {
         JpgraphError::Raise("You can't specify negative sizes for Gantt graph dimensions. Use 0 to indicate that you want the library to automatically determine a dimension.");
     }
     Graph::Graph($aWidth, $aHeight, $aCachedName, $aTimeOut, $aInline);
     $this->scale = new GanttScale($this->img);
     if ($aWidth > 0) {
         $this->img->SetMargin($aWidth / 17, $aWidth / 17, $aHeight / 7, $aHeight / 10);
     }
     $this->scale->ShowHeaders(GANTT_HWEEK | GANTT_HDAY);
     $this->SetBox();
 }
开发者ID:GeorgeAlexandre,项目名称:yipservicedesk,代码行数:20,代码来源:jpgraph_gantt.php

示例4: GetBarMinMax

 function GetBarMinMax()
 {
     $start = 0;
     $n = count($this->iObj);
     while ($this->iObj[$start]->GetMaxDate() === false && $start < $n) {
         ++$start;
     }
     if ($start >= $n) {
         JpgraphError::Raise('Cannot autoscale Gantt chart. No dated activities exist. [GetBarMinMax() start >= n]');
     }
     $max = $this->scale->NormalizeDate($this->iObj[$start]->GetMaxDate());
     $min = $this->scale->NormalizeDate($this->iObj[$start]->GetMinDate());
     for ($i = $start + 1; $i < $n; ++$i) {
         $rmax = $this->scale->NormalizeDate($this->iObj[$i]->GetMaxDate());
         if ($rmax != false) {
             $max = Max($max, $rmax);
         }
         $rmin = $this->scale->NormalizeDate($this->iObj[$i]->GetMinDate());
         if ($rmin != false) {
             $min = Min($min, $rmin);
         }
     }
     $minDate = date("Y-m-d", $min);
     $min = strtotime($minDate);
     $maxDate = date("Y-m-d 23:59", $max);
     $max = strtotime($maxDate);
     return array($min, $max);
 }
开发者ID:shinichi85,项目名称:voiperopen,代码行数:28,代码来源:jpgraph_gantt.php

示例5: SetColorIndication

 /**
  * Set the specification of the color backgrounds and also the
  * optional exact colors to be used
  * 
  * @param mixed $aSpec  An array of 3 1x2 arrays. Each array specify the 
  * color indication value at x=0 and x=max x in order to determine the slope
  * @param mixed $aColors  An array with four elements specifying the colors
  * of each color indicator
  */
 public function SetColorIndication(array $aSpec, array $aColors = null)
 {
     if (count($aSpec) !== 3) {
         JpgraphError::Raise('Specification of scale values for background indicators must be an array with three elements.');
     }
     $this->iColorInd = $aSpec;
     if ($aColors !== null) {
         if (is_array($aColors) && count($aColors) == 4) {
             $this->iColorSpec = $aColors;
         } else {
             JpGraphError::Raise('Color specification for background indication must have four colors.');
         }
     }
 }
开发者ID:hcvcastro,项目名称:pxp,代码行数:23,代码来源:ccbpgraph.class.php


注:本文中的JpgraphError::Raise方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。