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


PHP RectPatternFactory类代码示例

本文整理汇总了PHP中RectPatternFactory的典型用法代码示例。如果您正苦于以下问题:PHP RectPatternFactory类的具体用法?PHP RectPatternFactory怎么用?PHP RectPatternFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 function __construct($aDir, $aPattern, $aMin, $aMax, $aColor = "black", $aWeight = 1, $aDepth = DEPTH_BACK)
 {
     $f = new RectPatternFactory();
     $this->prect = $f->Create($aPattern, $aColor, $aWeight);
     if (is_numeric($aMin) && is_numeric($aMax) && $aMin > $aMax) {
         JpGraphError::RaiseL(16004);
     }
     //('Min value for plotband is larger than specified max value. Please correct.');
     $this->dir = $aDir;
     $this->min = $aMin;
     $this->max = $aMax;
     $this->depth = $aDepth;
 }
开发者ID:awlx,项目名称:librenms,代码行数:13,代码来源:jpgraph_plotband.php

示例2: Stroke


//.........这里部分代码省略.........
     foreach ($this->txtcol as $p) {
         // STROKE DEBUG BOX
         if (_JPG_DEBUG) {
             $aImg->SetLineWeight(1);
             $aImg->SetColor('red');
             $aImg->SetLineStyle('solid');
             $aImg->Rectangle($xp, $y1, $xp + $abs_width, $y1 + $rowheight[$row]);
         }
         $aImg->SetLineWeight($this->weight);
         $x1 = round($x1);
         $y1 = round($y1);
         if ($p[2] != "" && $p[2]->GetType() > -1) {
             // Make a plot mark legend
             $aImg->SetColor($p[1]);
             if (is_string($p[3]) || $p[3] > 0) {
                 $aImg->SetLineStyle($p[3]);
                 $aImg->StyleLine($x1 - $this->mark_abs_hsize, $y1 + $f2, $x1 + $this->mark_abs_hsize, $y1 + $f2);
             }
             // Stroke a mark with the standard size
             // (As long as it is not an image mark )
             if ($p[2]->GetType() != MARK_IMG) {
                 $p[2]->iFormatCallback = '';
                 // Since size for circles is specified as the radius
                 // this means that we must half the size to make the total
                 // width behave as the other marks
                 if ($p[2]->GetType() == MARK_FILLEDCIRCLE || $p[2]->GetType() == MARK_CIRCLE) {
                     $p[2]->SetSize(min($this->mark_abs_vsize, $this->mark_abs_hsize) / 2);
                     $p[2]->Stroke($aImg, $x1, $y1 + $f2);
                 } else {
                     $p[2]->SetSize(min($this->mark_abs_vsize, $this->mark_abs_hsize));
                     $p[2]->Stroke($aImg, $x1, $y1 + $f2);
                 }
             }
         } elseif ($p[2] != "" && (is_string($p[3]) || $p[3] > 0)) {
             // Draw a styled line
             $aImg->SetColor($p[1]);
             $aImg->SetLineStyle($p[3]);
             $aImg->StyleLine($x1 - 1, $y1 + $f2, $x1 + $this->mark_abs_hsize, $y1 + $f2);
             $aImg->StyleLine($x1 - 1, $y1 + $f2 + 1, $x1 + $this->mark_abs_hsize, $y1 + $f2 + 1);
         } else {
             // Draw a colored box
             $color = $p[1];
             // We make boxes slightly larger to better show
             $boxsize = min($this->mark_abs_vsize, $this->mark_abs_hsize) + 2;
             $ym = round($y1 + $f2 - $boxsize / 2);
             // We either need to plot a gradient or a
             // pattern. To differentiate we use a kludge.
             // Patterns have a p[3] value of < -100
             if ($p[3] < -100) {
                 // p[1][0] == iPattern, p[1][1] == iPatternColor, p[1][2] == iPatternDensity
                 if ($patternFactory == null) {
                     $patternFactory = new RectPatternFactory();
                 }
                 $prect = $patternFactory->Create($p[1][0], $p[1][1], 1);
                 $prect->SetBackground($p[1][3]);
                 $prect->SetDensity($p[1][2] + 1);
                 $prect->SetPos(new Rectangle($x1, $ym, $boxsize, $boxsize));
                 $prect->Stroke($aImg);
                 $prect = null;
             } else {
                 if (is_array($color) && count($color) == 2) {
                     // The client want a gradient color
                     $grad->FilledRectangle($x1, $ym, $x1 + $boxsize, $ym + $boxsize, $color[0], $color[1], -$p[3]);
                 } else {
                     $aImg->SetColor($p[1]);
                     $aImg->FilledRectangle($x1, $ym, $x1 + $boxsize, $ym + $boxsize);
                 }
                 $aImg->SetColor($this->color);
                 $aImg->SetLineWeight($fillBoxFrameWeight);
                 $aImg->Rectangle($x1, $ym, $x1 + $boxsize, $ym + $boxsize);
             }
         }
         $aImg->SetColor($this->font_color);
         $aImg->SetFont($this->font_family, $this->font_style, $this->font_size);
         $aImg->SetTextAlign("left", "top");
         $aImg->StrokeText(round($x1 + $this->mark_abs_hsize + $this->xmargin), $y1, $p[0]);
         // Add CSIM for Legend if defined
         if ($p[4] != "") {
             $xe = $x1 + $this->xmargin + $this->mark_abs_hsize + $aImg->GetTextWidth($p[0]);
             $ye = $y1 + max($this->mark_abs_vsize, $aImg->GetTextHeight($p[0]));
             $coords = "{$x1},{$y1},{$xe},{$y1},{$xe},{$ye},{$x1},{$ye}";
             if (!empty($p[4])) {
                 $this->csimareas .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . $p[4] . "\"";
                 if (!empty($p[5])) {
                     $tmp = sprintf($p[5], $p[0]);
                     $this->csimareas .= " title=\"{$tmp}\"";
                 }
                 $this->csimareas .= " alt=\"\" />\n";
             }
         }
         if ($i >= $this->layout_n) {
             $x1 = $xp + $this->mark_abs_hsize + $this->xlmargin;
             $y1 += $rowheight[$row++];
             $i = 1;
         } else {
             $x1 += $colwidth[($i - 1) % $numcolumns];
             ++$i;
         }
     }
 }
开发者ID:sudogem,项目名称:brcms,代码行数:101,代码来源:jpgraph.php

示例3: Stroke


//.........这里部分代码省略.........
                 $sp2[3] = $pts[3];
                 $sp2[4] = $pts[2] + $ssh;
                 $sp2[5] = $pts[3] - $ssv;
                 $sp2[6] = $pts[4] + $ssh;
                 $sp2[7] = $pts[5] - $ssv;
             } elseif ($val < 0) {
                 $sp1[0] = $pts[4];
                 $sp1[1] = $pts[5];
                 $sp1[2] = $pts[6];
                 $sp1[3] = $pts[7];
                 $sp1[4] = $pts[6] + $ssh;
                 $sp1[5] = $pts[7] - $ssv;
                 $sp1[6] = $pts[4] + $ssh;
                 $sp1[7] = $pts[5] - $ssv;
                 $sp2[0] = $pts[6];
                 $sp2[1] = $pts[7];
                 $sp2[2] = $pts[0];
                 $sp2[3] = $pts[1];
                 $sp2[4] = $pts[0] + $ssh;
                 $sp2[5] = $pts[1] - $ssv;
                 $sp2[6] = $pts[6] + $ssh;
                 $sp2[7] = $pts[7] - $ssv;
             }
             $base_color = $this->fill_color;
             $img->PushColor($base_color . ':0.7');
             $img->FilledPolygon($sp1);
             $img->PopColor();
             $img->PushColor($base_color . ':1.1');
             $img->FilledPolygon($sp2);
             $img->PopColor();
         }
         // Stroke the pattern
         if (is_array($this->iPattern)) {
             $f = new RectPatternFactory();
             if (is_array($this->iPatternColor)) {
                 $pcolor = $this->iPatternColor[$i % $np];
             } else {
                 $pcolor = $this->iPatternColor;
             }
             $prect = $f->Create($this->iPattern[$i % $np], $pcolor, 1);
             $prect->SetDensity($this->iPatternDensity[$i % $np]);
             if ($val < 0) {
                 $rx = $pts[0];
                 $ry = $pts[1];
             } else {
                 $rx = $pts[2];
                 $ry = $pts[3];
             }
             $width = abs($pts[4] - $pts[0]) + 1;
             $height = abs($pts[1] - $pts[3]) + 1;
             $prect->SetPos(new Rectangle($rx, $ry, $width, $height));
             $prect->Stroke($img);
         } else {
             if ($this->iPattern > -1) {
                 $f = new RectPatternFactory();
                 $prect = $f->Create($this->iPattern, $this->iPatternColor, 1);
                 $prect->SetDensity($this->iPatternDensity);
                 if ($val < 0) {
                     $rx = $pts[0];
                     $ry = $pts[1];
                 } else {
                     $rx = $pts[2];
                     $ry = $pts[3];
                 }
                 $width = abs($pts[4] - $pts[0]) + 1;
                 $height = abs($pts[1] - $pts[3]) + 1;
开发者ID:amenadiel,项目名称:jpgraph,代码行数:67,代码来源:BarPlot.php

示例4: Stroke

 function Stroke($aImg, $aScale)
 {
     $factory = new RectPatternFactory();
     $prect = $factory->Create($this->iPattern, $this->iPatternColor);
     $prect->SetDensity($this->iPatternDensity);
     // If height factor is specified as a float between 0,1 then we take it as meaning
     // percetage of the scale width between horizontal line.
     // If it is an integer > 1 we take it to mean the absolute height in pixels
     if ($this->iHeightFactor > -0.0 && $this->iHeightFactor <= 1.1) {
         $vs = $aScale->GetVertSpacing() * $this->iHeightFactor;
     } elseif (is_int($this->iHeightFactor) && $this->iHeightFactor > 2 && $this->iHeightFactor < 200) {
         $vs = $this->iHeightFactor;
     } else {
         JpGraphError::RaiseL(6028, $this->iHeightFactor);
     }
     //("Specified height (".$this->iHeightFactor.") for gantt bar is out of range.");
     // Clip date to min max dates to show
     $st = $aScale->NormalizeDate($this->iStart);
     $en = $aScale->NormalizeDate($this->iEnd);
     $limst = max($st, $aScale->iStartDate);
     $limen = min($en, $aScale->iEndDate);
     $xt = round($aScale->TranslateDate($limst));
     $xb = round($aScale->TranslateDate($limen));
     $yt = round($aScale->TranslateVertPos($this->iVPos) - $vs - ($aScale->GetVertSpacing() / 2 - $vs / 2));
     $yb = round($aScale->TranslateVertPos($this->iVPos) - ($aScale->GetVertSpacing() / 2 - $vs / 2));
     $middle = round($yt + ($yb - $yt) / 2);
     $this->StrokeActInfo($aImg, $aScale, $middle);
     // CSIM for title
     if (!empty($this->title->csimtarget)) {
         $colwidth = $this->title->GetColWidth($aImg);
         $colstarts = array();
         $aScale->actinfo->GetColStart($aImg, $colstarts, true);
         $n = min(count($colwidth), count($this->title->csimtarget));
         for ($i = 0; $i < $n; ++$i) {
             $title_xt = $colstarts[$i];
             $title_xb = $title_xt + $colwidth[$i];
             $coords = "{$title_xt},{$yt},{$title_xb},{$yt},{$title_xb},{$yb},{$title_xt},{$yb}";
             if (!empty($this->title->csimtarget[$i])) {
                 $this->csimarea .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . $this->title->csimtarget[$i] . "\"";
                 if (!empty($this->title->csimwintarget[$i])) {
                     $this->csimarea .= "target=\"" . $this->title->csimwintarget[$i] . "\" ";
                 }
                 if (!empty($this->title->csimalt[$i])) {
                     $tmp = $this->title->csimalt[$i];
                     $this->csimarea .= " title=\"{$tmp}\" alt=\"{$tmp}\" ";
                 }
                 $this->csimarea .= " />\n";
             }
         }
     }
     // Check if the bar is totally outside the current scale range
     if ($en < $aScale->iStartDate || $st > $aScale->iEndDate) {
         return;
     }
     // Remember the positions for the bar
     $this->SetConstrainPos($xt, $yt, $xb, $yb);
     $prect->ShowFrame(false);
     $prect->SetBackground($this->iFillColor);
     if ($this->iShadow) {
         $aImg->SetColor($this->iFrameColor);
         $aImg->ShadowRectangle($xt, $yt, $xb, $yb, $this->iFillColor, $this->iShadowWidth, $this->iShadowColor);
         $prect->SetPos(new Rectangle($xt + 1, $yt + 1, $xb - $xt - $this->iShadowWidth - 2, $yb - $yt - $this->iShadowWidth - 2));
         $prect->Stroke($aImg);
     } else {
         $prect->SetPos(new Rectangle($xt, $yt, $xb - $xt + 1, $yb - $yt + 1));
         $prect->Stroke($aImg);
         $aImg->SetColor($this->iFrameColor);
         $aImg->Rectangle($xt, $yt, $xb, $yb);
     }
     // CSIM for bar
     if (!empty($this->csimtarget)) {
         $coords = "{$xt},{$yt},{$xb},{$yt},{$xb},{$yb},{$xt},{$yb}";
         $this->csimarea .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . $this->csimtarget . "\"";
         if (!empty($this->csimwintarget)) {
             $this->csimarea .= " target=\"" . $this->csimwintarget . "\" ";
         }
         if ($this->csimalt != '') {
             $tmp = $this->csimalt;
             $this->csimarea .= " title=\"{$tmp}\" alt=\"{$tmp}\" ";
         }
         $this->csimarea .= " />\n";
     }
     // Draw progress bar inside activity bar
     if ($this->progress->iProgress > 0) {
         $xtp = $aScale->TranslateDate($st);
         $xbp = $aScale->TranslateDate($en);
         $len = ($xbp - $xtp) * $this->progress->iProgress;
         $endpos = $xtp + $len;
         if ($endpos > $xt) {
             // Take away the length of the progress that is not visible (before the start date)
             $len -= $xt - $xtp;
             // Is the the progress bar visible after the start date?
             if ($xtp < $xt) {
                 $xtp = $xt;
             }
             // Make sure that the progess bar doesn't extend over the end date
             if ($xtp + $len - 1 > $xb) {
                 $len = $xb - $xtp;
             }
             $prog = $factory->Create($this->progress->iPattern, $this->progress->iColor);
//.........这里部分代码省略.........
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:101,代码来源:jpgraph_gantt.php

示例5: Stroke


//.........这里部分代码省略.........
                         $sp[6] = $pts[2] + $ssh;
                         $sp[7] = $pts[3] - $ssv;
                         $sp[8] = $pts[2];
                         $sp[9] = $pts[3] - 1;
                         $sp[10] = $pts[4] + 1;
                         $sp[11] = $pts[5];
                         $img->FilledPolygon($sp, 4);
                     } elseif ($accy_neg < 0) {
                         $nsp[6] = $pts[4] + $ssh;
                         $nsp[7] = $pts[5] - $ssv;
                         $nsp[8] = $pts[4] + 1;
                         $nsp[9] = $pts[5];
                         $img->FilledPolygon($nsp, 4);
                     }
                     $img->PopColor();
                 }
             }
             // If value is NULL or 0, then don't draw a bar at all
             if ($this->plots[$j]->coords[0][$i] == 0) {
                 continue;
             }
             if ($this->plots[$j]->grad) {
                 $grad = new Gradient($img);
                 $grad->FilledRectangle($pts[2], $pts[3], $pts[6], $pts[7], $this->plots[$j]->grad_fromcolor, $this->plots[$j]->grad_tocolor, $this->plots[$j]->grad_style);
             } else {
                 if (is_array($this->plots[$j]->fill_color)) {
                     $numcolors = count($this->plots[$j]->fill_color);
                     $img->SetColor($this->plots[$j]->fill_color[$i % $numcolors]);
                 } else {
                     $img->SetColor($this->plots[$j]->fill_color);
                 }
                 $img->FilledPolygon($pts);
                 $img->SetColor($this->plots[$j]->color);
             }
             // Stroke the pattern
             if ($this->plots[$j]->iPattern > -1) {
                 if ($pattern === NULL) {
                     $pattern = new RectPatternFactory();
                 }
                 $prect = $pattern->Create($this->plots[$j]->iPattern, $this->plots[$j]->iPatternColor, 1);
                 $prect->SetDensity($this->plots[$j]->iPatternDensity);
                 $prect->SetPos(new Rectangle($pts[2], $pts[3], $pts[4] - $pts[0] + 1, $pts[1] - $pts[3] + 1));
                 $prect->Stroke($img);
             }
             // CSIM array
             if ($i < count($this->plots[$j]->csimtargets)) {
                 // Create the client side image map
                 $rpts = $img->ArrRotate($pts);
                 $csimcoord = round($rpts[0]) . ", " . round($rpts[1]);
                 for ($k = 1; $k < 4; ++$k) {
                     $csimcoord .= ", " . round($rpts[2 * $k]) . ", " . round($rpts[2 * $k + 1]);
                 }
                 if (!empty($this->plots[$j]->csimtargets[$i])) {
                     $this->csimareas .= '<area shape="poly" coords="' . $csimcoord . '" ';
                     $this->csimareas .= " href=\"" . $this->plots[$j]->csimtargets[$i] . "\"";
                     if (!empty($this->plots[$j]->csimalts[$i])) {
                         $sval = sprintf($this->plots[$j]->csimalts[$i], $this->plots[$j]->coords[0][$i]);
                         $this->csimareas .= " alt=\"{$sval}\" title=\"{$sval}\" ";
                     }
                     $this->csimareas .= ">\n";
                 }
             }
             $pts[] = $pts[0];
             $pts[] = $pts[1];
             $img->Polygon($pts);
         }
         // Draw labels for each acc.bar
         $x = $pts[2] + ($pts[4] - $pts[2]) / 2;
         $y = $yscale->Translate($accy);
         if ($this->bar_shadow) {
             $x += $ssh;
         }
         $this->value->Stroke($img, $accy, $x, $y);
         $accy = 0;
         $accy_neg = 0;
         for ($j = 0; $j < $this->nbrplots; ++$j) {
             // We don't print 0 values in an accumulated bar plot
             if ($this->plots[$j]->coords[0][$i] == 0) {
                 continue;
             }
             if ($this->plots[$j]->coords[0][$i] > 0) {
                 $yt = $yscale->Translate($this->plots[$j]->coords[0][$i] + $accy);
                 $accyt = $yscale->Translate($accy);
                 $y = $accyt - ($accyt - $yt) / 2;
                 $accy += $this->plots[$j]->coords[0][$i];
             } else {
                 $yt = $yscale->Translate($this->plots[$j]->coords[0][$i] + $accy_neg);
                 $accyt = $yscale->Translate($accy_neg);
                 //$y=0;
                 $accy_neg += $this->plots[$j]->coords[0][$i];
                 $y = $accyt - ($accyt - $yt) / 2;
                 // TODO : Check this fix
             }
             $this->plots[$j]->value->SetAlign("center", "center");
             $this->plots[$j]->value->SetMargin(0);
             $this->plots[$j]->value->Stroke($img, $this->plots[$j]->coords[0][$i], $x, $y);
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:101,代码来源:jpgraph_bar.php

示例6: Stroke


//.........这里部分代码省略.........
                             $style = $this->plots[$j]->grad_fromcolor[$i % $ng][2];
                         }
                     } else {
                         $fromcolor = $this->plots[$j]->grad_fromcolor[$i % $ng][0];
                         $tocolor = $this->plots[$j]->grad_fromcolor[$i % $ng][1];
                         $style = $this->plots[$j]->grad_fromcolor[$i % $ng][2];
                     }
                     $grad->FilledRectangle($pts[2], $pts[3], $pts[6], $pts[7], $fromcolor, $tocolor, $style);
                 } else {
                     $grad->FilledRectangle($pts[2], $pts[3], $pts[6], $pts[7], $this->plots[$j]->grad_fromcolor, $this->plots[$j]->grad_tocolor, $this->plots[$j]->grad_style);
                 }
             } else {
                 if (is_array($this->plots[$j]->fill_color)) {
                     $numcolors = count($this->plots[$j]->fill_color);
                     $fillcolor = $this->plots[$j]->fill_color[$i % $numcolors];
                     // If the bar is specified to be non filled then the fill color is false
                     if ($fillcolor !== false) {
                         $img->SetColor($this->plots[$j]->fill_color[$i % $numcolors]);
                     }
                 } else {
                     $fillcolor = $this->plots[$j]->fill_color;
                     if ($fillcolor !== false) {
                         $img->SetColor($this->plots[$j]->fill_color);
                     }
                 }
                 if ($fillcolor !== false) {
                     $img->FilledPolygon($pts);
                 }
             }
             $img->SetColor($this->plots[$j]->color);
             // Stroke the pattern
             if ($this->plots[$j]->iPattern > -1) {
                 if ($pattern === NULL) {
                     $pattern = new RectPatternFactory();
                 }
                 $prect = $pattern->Create($this->plots[$j]->iPattern, $this->plots[$j]->iPatternColor, 1);
                 $prect->SetDensity($this->plots[$j]->iPatternDensity);
                 if ($this->plots[$j]->coords[0][$i] < 0) {
                     $rx = $pts[0];
                     $ry = $pts[1];
                 } else {
                     $rx = $pts[2];
                     $ry = $pts[3];
                 }
                 $width = abs($pts[4] - $pts[0]) + 1;
                 $height = abs($pts[1] - $pts[3]) + 1;
                 $prect->SetPos(new Rectangle($rx, $ry, $width, $height));
                 $prect->Stroke($img);
             }
             // CSIM array
             if ($i < count($this->plots[$j]->csimtargets)) {
                 // Create the client side image map
                 $rpts = $img->ArrRotate($pts);
                 $csimcoord = round($rpts[0]) . ", " . round($rpts[1]);
                 for ($k = 1; $k < 4; ++$k) {
                     $csimcoord .= ", " . round($rpts[2 * $k]) . ", " . round($rpts[2 * $k + 1]);
                 }
                 if (!empty($this->plots[$j]->csimtargets[$i])) {
                     $this->csimareas .= '<area shape="poly" coords="' . $csimcoord . '" ';
                     $this->csimareas .= " href=\"" . $this->plots[$j]->csimtargets[$i] . "\" ";
                     if (!empty($this->plots[$j]->csimwintargets[$i])) {
                         $this->csimareas .= " target=\"" . $this->plots[$j]->csimwintargets[$i] . "\" ";
                     }
                     $sval = '';
                     if (!empty($this->plots[$j]->csimalts[$i])) {
                         $sval = sprintf($this->plots[$j]->csimalts[$i], $this->plots[$j]->coords[0][$i]);
开发者ID:thctlo,项目名称:1.2.0,代码行数:67,代码来源:jpgraph_bar.php

示例7: Stroke


//.........这里部分代码省略.........
                 $sp[7] = $pts[3] - $ssv;
                 $sp[8] = $pts[4] + $ssh;
                 $sp[9] = $pts[5] - $ssv;
                 $sp[10] = $pts[6] + $ssh;
                 $sp[11] = $pts[7] - $ssv;
             } elseif ($val < 0) {
                 $sp[0] = $pts[4];
                 $sp[1] = $pts[5];
                 $sp[2] = $pts[6];
                 $sp[3] = $pts[7];
                 $sp[4] = $pts[0];
                 $sp[5] = $pts[1];
                 $sp[6] = $pts[0] + $ssh;
                 $sp[7] = $pts[1] - $ssv;
                 $sp[8] = $pts[6] + $ssh;
                 $sp[9] = $pts[7] - $ssv;
                 $sp[10] = $pts[4] + $ssh;
                 $sp[11] = $pts[5] - $ssv;
             }
             if (is_array($this->bar_shadow_color)) {
                 $numcolors = count($this->bar_shadow_color);
                 if ($numcolors == 0) {
                     JpGraphError::Raise('You have specified an empty array for shadow colors in the bar plot.');
                 }
                 $img->PushColor($this->bar_shadow_color[$i % $numcolors]);
             } else {
                 $img->PushColor($this->bar_shadow_color);
             }
             $img->FilledPolygon($sp);
             $img->PopColor();
         }
         // Stroke the pattern
         if ($this->iPattern > -1) {
             $f = new RectPatternFactory();
             $prect = $f->Create($this->iPattern, $this->iPatternColor, 1);
             $prect->SetDensity($this->iPatternDensity);
             $prect->SetPos(new Rectangle($pts[2], $pts[3], $pts[4] - $pts[0] + 1, $pts[1] - $pts[3] + 1));
             $prect->Stroke($img);
         }
         // Stroke the outline of the bar
         if (is_array($this->color)) {
             $img->SetColor($this->color[$i % count($this->color)]);
         } else {
             $img->SetColor($this->color);
         }
         $pts[] = $pts[0];
         $pts[] = $pts[1];
         if ($this->weight > 0) {
             $img->SetLineWeight($this->weight);
             $img->Polygon($pts);
         }
         // Determine how to best position the values of the individual bars
         $x = $pts[2] + ($pts[4] - $pts[2]) / 2;
         if ($this->valuepos == 'top') {
             $y = $pts[3];
             if ($img->a === 90) {
                 if ($val < 0) {
                     $this->value->SetAlign('right', 'center');
                 } else {
                     $this->value->SetAlign('left', 'center');
                 }
             }
             $this->value->Stroke($img, $val, $x, $y);
         } elseif ($this->valuepos == 'max') {
             $y = $pts[3];
             if ($img->a === 90) {
开发者ID:tavo1981,项目名称:phpbar,代码行数:67,代码来源:jpgraph_bar.php

示例8: Stroke


//.........这里部分代码省略.........
             // Stroke a mark using image
             if ($p[2]->GetType() == MARK_IMG) {
                 $p[2]->Stroke($aImg, $x1, $marky);
             }
             // Stroke a mark with the standard size
             // (As long as it is not an image mark )
             if ($p[2]->GetType() != MARK_IMG) {
                 // Clear any user callbacks since we ont want them called for
                 // the legend marks
                 $p[2]->iFormatCallback = '';
                 $p[2]->iFormatCallback2 = '';
                 // Since size for circles is specified as the radius
                 // this means that we must half the size to make the total
                 // width behave as the other marks
                 if ($p[2]->GetType() == MARK_FILLEDCIRCLE || $p[2]->GetType() == MARK_CIRCLE) {
                     $p[2]->SetSize(min($this->mark_abs_vsize, $this->mark_abs_hsize) / 2);
                     $p[2]->Stroke($aImg, $x1, $marky);
                 } else {
                     $p[2]->SetSize(min($this->mark_abs_vsize, $this->mark_abs_hsize));
                     $p[2]->Stroke($aImg, $x1, $marky);
                 }
             }
         } elseif (!empty($p[2]) && (is_string($p[3]) || $p[3] > 0)) {
             // Draw a styled line
             $aImg->SetColor($p[1]);
             $aImg->SetLineStyle($p[3]);
             $aImg->StyleLine($x1 - $this->mark_abs_hsize, $marky, $x1 + $this->mark_abs_hsize, $marky);
             $aImg->StyleLine($x1 - $this->mark_abs_hsize, $marky + 1, $x1 + $this->mark_abs_hsize, $marky + 1);
         } else {
             // Draw a colored box
             $color = $p[1];
             // We make boxes slightly larger to better show
             $boxsize = max($this->mark_abs_vsize, $this->mark_abs_hsize) + 2;
             $ym = $marky - ceil($boxsize / 2);
             // Marker y-coordinate
             // We either need to plot a gradient or a
             // pattern. To differentiate we use a kludge.
             // Patterns have a p[3] value of < -100
             if ($p[3] < -100) {
                 // p[1][0] == iPattern, p[1][1] == iPatternColor, p[1][2] == iPatternDensity
                 if ($patternFactory == null) {
                     $patternFactory = new RectPatternFactory();
                 }
                 $prect = $patternFactory->Create($p[1][0], $p[1][1], 1);
                 $prect->SetBackground($p[1][3]);
                 $prect->SetDensity($p[1][2] + 1);
                 $prect->SetPos(new Rectangle($x1, $ym, $boxsize, $boxsize));
                 $prect->Stroke($aImg);
                 $prect = null;
             } else {
                 if (is_array($color) && count($color) == 2) {
                     // The client want a gradient color
                     $grad->FilledRectangle($x1 - $boxsize / 2, $ym, $x1 + $boxsize / 2, $ym + $boxsize, $color[0], $color[1], -$p[3]);
                 } else {
                     $aImg->SetColor($p[1]);
                     $aImg->FilledRectangle($x1 - $boxsize / 2, $ym, $x1 + $boxsize / 2, $ym + $boxsize);
                 }
                 // Draw a plot frame line
                 $aImg->SetColor($this->color);
                 $aImg->SetLineWeight($fillBoxFrameWeight);
                 $aImg->Rectangle($x1 - $boxsize / 2, $ym, $x1 + $boxsize / 2, $ym + $boxsize);
             }
         }
         $aImg->SetColor($this->font_color);
         $aImg->SetFont($this->font_family, $this->font_style, $this->font_size);
         $aImg->SetTextAlign('left', 'baseline');
         $debug = false;
         $aImg->StrokeText($x1 + $this->mark_abs_hsize + $this->xmargin, $y1, $p[0], 0, 'left', $debug);
         // Add CSIM for Legend if defined
         if (!empty($p[4])) {
             $xs = $x1 - $this->mark_abs_hsize;
             $ys = $y1 + 1;
             $xe = $x1 + $aImg->GetTextWidth($p[0]) + $this->mark_abs_hsize + $this->xmargin;
             $ye = $y1 - $rowheight[$row] + 1;
             $coords = "{$xs},{$ys},{$xe},{$y1},{$xe},{$ye},{$xs},{$ye}";
             if (!empty($p[4])) {
                 $this->csimareas .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . htmlentities($p[4]) . "\"";
                 if (!empty($p[6])) {
                     $this->csimareas .= " target=\"" . $p[6] . "\"";
                 }
                 if (!empty($p[5])) {
                     $tmp = sprintf($p[5], $p[0]);
                     $this->csimareas .= " title=\"{$tmp}\" alt=\"{$tmp}\" ";
                 }
                 $this->csimareas .= " />\n";
             }
         }
         if ($i >= $this->layout_n) {
             $x1 = $xp + $this->xlmargin;
             $row++;
             if (!empty($rowheight[$row])) {
                 $y1 += $rowheight[$row];
             }
             $i = 1;
         } else {
             $x1 += $colwidth[($i - 1) % $numcolumns];
             ++$i;
         }
     }
 }
开发者ID:sgdoc,项目名称:sgdoce-codigo,代码行数:101,代码来源:Legend.php

示例9: PlotBand

 function PlotBand($aDir, $aPattern, $aMin, $aMax, $aColor = "black", $aWeight = 1, $aDepth = DEPTH_BACK)
 {
     $f = new RectPatternFactory();
     $this->prect = $f->Create($aPattern, $aColor, $aWeight);
     $this->dir = $aDir;
     $this->min = $aMin;
     $this->max = $aMax;
     $this->depth = $aDepth;
 }
开发者ID:rrsc,项目名称:freemed,代码行数:9,代码来源:jpgraph.php

示例10: PlotBand

 function PlotBand($aDir, $aPattern, $aMin, $aMax, $aColor = "black", $aWeight = 1, $aDepth = DEPTH_BACK)
 {
     $f = new RectPatternFactory();
     $this->prect = $f->Create($aPattern, $aColor, $aWeight);
     if (is_numeric($aMin) && is_numeric($aMax) && $aMin > $aMax) {
         JpGraphError::RaiseL(16004);
     }
     $this->dir = $aDir;
     $this->min = $aMin;
     $this->max = $aMax;
     $this->depth = $aDepth;
 }
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:12,代码来源:jpgraph_plotband.php

示例11: Stroke

 function Stroke(&$aImg, $aScale)
 {
     $factory = new RectPatternFactory();
     $prect = $factory->Create($this->iPattern, $this->iPatternColor);
     $prect->SetDensity($this->iPatternDensity);
     if ($this->iHeightFactor > -0.0 && $this->iHeightFactor <= 1.1) {
         $vs = $aScale->GetVertSpacing() * $this->iHeightFactor;
     } elseif (is_int($this->iHeightFactor) && $this->iHeightFactor > 2 && $this->iHeightFactor < 200) {
         $vs = $this->iHeightFactor;
     } else {
         JpGraphError::RaiseL(6028, $this->iHeightFactor);
     }
     $st = $aScale->NormalizeDate($this->iStart);
     $en = $aScale->NormalizeDate($this->iEnd);
     $limst = max($st, $aScale->iStartDate);
     $limen = min($en, $aScale->iEndDate);
     $xt = round($aScale->TranslateDate($limst));
     $xb = round($aScale->TranslateDate($limen));
     $yt = round($aScale->TranslateVertPos($this->iVPos) - $vs - ($aScale->GetVertSpacing() / 2 - $vs / 2));
     $yb = round($aScale->TranslateVertPos($this->iVPos) - ($aScale->GetVertSpacing() / 2 - $vs / 2));
     $middle = round($yt + ($yb - $yt) / 2);
     $this->StrokeActInfo($aImg, $aScale, $middle);
     if (!empty($this->title->csimtarget)) {
         $colwidth = $this->title->GetColWidth($aImg);
         $colstarts = array();
         $aScale->actinfo->GetColStart($aImg, $colstarts, true);
         $n = min(count($colwidth), count($this->title->csimtarget));
         for ($i = 0; $i < $n; ++$i) {
             $title_xt = $colstarts[$i];
             $title_xb = $title_xt + $colwidth[$i];
             $coords = "{$title_xt},{$yt},{$title_xb},{$yt},{$title_xb},{$yb},{$title_xt},{$yb}";
             if (!empty($this->title->csimtarget[$i])) {
                 $this->csimarea .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . $this->title->csimtarget[$i] . "\"";
                 if (!empty($this->title->csimwintarget[$i])) {
                     $this->csimarea .= "target=\"" . $this->title->csimwintarget[$i] . "\" ";
                 }
                 if (!empty($this->title->csimalt[$i])) {
                     $tmp = $this->title->csimalt[$i];
                     $this->csimarea .= " title=\"{$tmp}\" alt=\"{$tmp}\" ";
                 }
                 $this->csimarea .= " />\n";
             }
         }
     }
     if ($en < $aScale->iStartDate || $st > $aScale->iEndDate) {
         return;
     }
     $this->SetConstrainPos($xt, $yt, $xb, $yb);
     $prect->ShowFrame(false);
     $prect->SetBackground($this->iFillColor);
     if ($this->iShadow) {
         $aImg->SetColor($this->iFrameColor);
         $aImg->ShadowRectangle($xt, $yt, $xb, $yb, $this->iFillColor, $this->iShadowWidth, $this->iShadowColor);
         $prect->SetPos(new Rectangle($xt + 1, $yt + 1, $xb - $xt - $this->iShadowWidth - 2, $yb - $yt - $this->iShadowWidth - 2));
         $prect->Stroke($aImg);
     } else {
         $prect->SetPos(new Rectangle($xt, $yt, $xb - $xt + 1, $yb - $yt + 1));
         $prect->Stroke($aImg);
         $aImg->SetColor($this->iFrameColor);
         $aImg->Rectangle($xt, $yt, $xb, $yb);
     }
     if (!empty($this->csimtarget)) {
         $coords = "{$xt},{$yt},{$xb},{$yt},{$xb},{$yb},{$xt},{$yb}";
         $this->csimarea .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . $this->csimtarget . "\"";
         if (!empty($this->csimwintarget)) {
             $this->csimarea .= " target=\"" . $this->csimwintarget . "\" ";
         }
         if ($this->csimalt != '') {
             $tmp = $this->csimalt;
             $this->csimarea .= " title=\"{$tmp}\" alt=\"{$tmp}\" ";
         }
         $this->csimarea .= "  />\n";
     }
     if ($this->progress->iProgress > 0) {
         $xtp = $aScale->TranslateDate($st);
         $xbp = $aScale->TranslateDate($en);
         $len = ($xbp - $xtp) * $this->progress->iProgress;
         $endpos = $xtp + $len;
         if ($endpos > $xt) {
             $len -= $xt - $xtp;
             if ($xtp < $xt) {
                 $xtp = $xt;
             }
             if ($xtp + $len - 1 > $xb) {
                 $len = $xb - $xtp;
             }
             $prog = $factory->Create($this->progress->iPattern, $this->progress->iColor);
             $prog->SetDensity($this->progress->iDensity);
             $prog->SetBackground($this->progress->iFillColor);
             $barheight = $yb - $yt + 1;
             if ($this->iShadow) {
                 $barheight -= $this->iShadowWidth;
             }
             $progressheight = floor($barheight * $this->progress->iHeight);
             $marg = ceil(($barheight - $progressheight) / 2);
             $pos = new Rectangle($xtp, $yt + $marg, $len, $barheight - 2 * $marg);
             $prog->SetPos($pos);
             $prog->Stroke($aImg);
         }
     }
//.........这里部分代码省略.........
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:101,代码来源:jpgraph_gantt.php

示例12: Stroke

 function Stroke(&$img, &$xscale, &$yscale)
 {
     $pattern = NULL;
     $img->SetLineWeight($this->weight);
     for ($i = 0; $i < $this->numpoints - 1; $i++) {
         $accy = 0;
         $accy_neg = 0;
         for ($j = 0; $j < $this->nbrplots; ++$j) {
             $img->SetColor($this->plots[$j]->color);
             if ($this->plots[$j]->coords[0][$i] >= 0) {
                 $yt = $yscale->Translate($this->plots[$j]->coords[0][$i] + $accy);
                 $accyt = $yscale->Translate($accy);
                 $accy += $this->plots[$j]->coords[0][$i];
             } else {
                 $yt = $yscale->Translate($this->plots[$j]->coords[0][$i] + $accy_neg);
                 $accyt = $yscale->Translate($accy_neg);
                 $accy_neg += $this->plots[$j]->coords[0][$i];
             }
             $xt = $xscale->Translate($i);
             if ($this->abswidth > -1) {
                 $abswidth = $this->abswidth;
             } else {
                 $abswidth = round($this->width * $xscale->scale_factor, 0);
             }
             $pts = array($xt, $accyt, $xt, $yt, $xt + $abswidth, $yt, $xt + $abswidth, $accyt);
             if ($this->bar_shadow) {
                 $ssh = $this->bar_shadow_hsize;
                 $ssv = $this->bar_shadow_vsize;
                 if ($j === 0) {
                     $sp[0] = $pts[6] + 1;
                     $sp[1] = $pts[7];
                     $sp[2] = $pts[6] + $ssh;
                     $sp[3] = $pts[7] - $ssv;
                     $nsp[0] = $pts[0];
                     $nsp[1] = $pts[1];
                     $nsp[2] = $pts[0] + $ssh;
                     $nsp[3] = $pts[1] - $ssv;
                     $nsp[4] = $pts[6] + $ssh;
                     $nsp[5] = $pts[7] - $ssv;
                     $nsp[10] = $pts[6] + 1;
                     $nsp[11] = $pts[7];
                 }
                 if ($j === $this->nbrplots - 1) {
                     if (is_array($this->bar_shadow_color)) {
                         $numcolors = count($this->bar_shadow_color);
                         if ($numcolors == 0) {
                             JpGraphError::RaiseL(2013);
                         }
                         $img->PushColor($this->bar_shadow_color[$i % $numcolors]);
                     } else {
                         $img->PushColor($this->bar_shadow_color);
                     }
                     if ($accy > 0) {
                         $sp[4] = $pts[4] + $ssh;
                         $sp[5] = $pts[5] - $ssv;
                         $sp[6] = $pts[2] + $ssh;
                         $sp[7] = $pts[3] - $ssv;
                         $sp[8] = $pts[2];
                         $sp[9] = $pts[3] - 1;
                         $sp[10] = $pts[4] + 1;
                         $sp[11] = $pts[5];
                         $img->FilledPolygon($sp, 4);
                     } elseif ($accy_neg < 0) {
                         $nsp[6] = $pts[4] + $ssh;
                         $nsp[7] = $pts[5] - $ssv;
                         $nsp[8] = $pts[4] + 1;
                         $nsp[9] = $pts[5];
                         $img->FilledPolygon($nsp, 4);
                     }
                     $img->PopColor();
                 }
             }
             if ($this->plots[$j]->coords[0][$i] == 0) {
                 continue;
             }
             if ($this->plots[$j]->grad) {
                 $grad = new Gradient($img);
                 $grad->FilledRectangle($pts[2], $pts[3], $pts[6], $pts[7], $this->plots[$j]->grad_fromcolor, $this->plots[$j]->grad_tocolor, $this->plots[$j]->grad_style);
             } else {
                 if (is_array($this->plots[$j]->fill_color)) {
                     $numcolors = count($this->plots[$j]->fill_color);
                     $fillcolor = $this->plots[$j]->fill_color[$i % $numcolors];
                     if ($fillcolor !== false) {
                         $img->SetColor($this->plots[$j]->fill_color[$i % $numcolors]);
                     }
                 } else {
                     $fillcolor = $this->plots[$j]->fill_color;
                     if ($fillcolor !== false) {
                         $img->SetColor($this->plots[$j]->fill_color);
                     }
                 }
                 if ($fillcolor !== false) {
                     $img->FilledPolygon($pts);
                 }
                 $img->SetColor($this->plots[$j]->color);
             }
             if ($this->plots[$j]->iPattern > -1) {
                 if ($pattern === NULL) {
                     $pattern = new RectPatternFactory();
                 }
//.........这里部分代码省略.........
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:101,代码来源:jpgraph_bar.php

示例13: Stroke


//.........这里部分代码省略.........
         $aImg->SetColor($this->fill_color);
         $aImg->FilledRectangle($xp, $yp, $xp + $abs_width, $yp + $abs_height);
         $aImg->SetColor($this->color);
         $aImg->Rectangle($xp, $yp, $xp + $abs_width, $yp + $abs_height);
     }
     $x1 = $xp + $this->mark_abs_hsize + $this->xlmargin;
     $y1 = $yp + $this->ymargin;
     $f2 = round($aImg->GetTextHeight('X') / 2);
     $grad = new Gradient($aImg);
     $patternFactory = null;
     $i = 1;
     $row = 0;
     foreach ($this->txtcol as $p) {
         if (_JPG_DEBUG) {
             $aImg->SetLineWeight(1);
             $aImg->SetColor('red');
             $aImg->SetLineStyle('solid');
             $aImg->Rectangle($xp, $y1, $xp + $abs_width, $y1 + $rowheight[$row]);
         }
         $aImg->SetLineWeight($this->weight);
         $x1 = round($x1);
         $y1 = round($y1);
         if ($p[2] && $p[2]->GetType() > -1) {
             $aImg->SetColor($p[1]);
             if (is_string($p[3]) || $p[3] > 0) {
                 $aImg->SetLineStyle($p[3]);
                 $aImg->StyleLine($x1 - $this->mark_abs_hsize, $y1 + $f2, $x1 + $this->mark_abs_hsize, $y1 + $f2);
             }
             if ($p[2]->GetType() != MARK_IMG) {
                 $p[2]->iFormatCallback = '';
                 $p[2]->iFormatCallback2 = '';
                 if ($p[2]->GetType() == MARK_FILLEDCIRCLE || $p[2]->GetType() == MARK_CIRCLE) {
                     $p[2]->SetSize(min($this->mark_abs_vsize, $this->mark_abs_hsize) / 2);
                     $p[2]->Stroke($aImg, $x1, $y1 + $f2);
                 } else {
                     $p[2]->SetSize(min($this->mark_abs_vsize, $this->mark_abs_hsize));
                     $p[2]->Stroke($aImg, $x1, $y1 + $f2);
                 }
             }
         } elseif ($p[2] && (is_string($p[3]) || $p[3] > 0)) {
             $aImg->SetColor($p[1]);
             $aImg->SetLineStyle($p[3]);
             $aImg->StyleLine($x1 - 1, $y1 + $f2, $x1 + $this->mark_abs_hsize, $y1 + $f2);
             $aImg->StyleLine($x1 - 1, $y1 + $f2 + 1, $x1 + $this->mark_abs_hsize, $y1 + $f2 + 1);
         } else {
             $color = $p[1];
             $boxsize = min($this->mark_abs_vsize, $this->mark_abs_hsize) + 2;
             $ym = round($y1 + $f2 - $boxsize / 2);
             if ($p[3] < -100) {
                 if ($patternFactory == null) {
                     $patternFactory = new RectPatternFactory();
                 }
                 $prect = $patternFactory->Create($p[1][0], $p[1][1], 1);
                 $prect->SetBackground($p[1][3]);
                 $prect->SetDensity($p[1][2] + 1);
                 $prect->SetPos(new Rectangle($x1, $ym, $boxsize, $boxsize));
                 $prect->Stroke($aImg);
                 $prect = null;
             } else {
                 if (is_array($color) && count($color) == 2) {
                     $grad->FilledRectangle($x1, $ym, $x1 + $boxsize, $ym + $boxsize, $color[0], $color[1], -$p[3]);
                 } else {
                     $aImg->SetColor($p[1]);
                     $aImg->FilledRectangle($x1, $ym, $x1 + $boxsize, $ym + $boxsize);
                 }
                 $aImg->SetColor($this->color);
                 $aImg->SetLineWeight($fillBoxFrameWeight);
                 $aImg->Rectangle($x1, $ym, $x1 + $boxsize, $ym + $boxsize);
             }
         }
         $aImg->SetColor($this->font_color);
         $aImg->SetFont($this->font_family, $this->font_style, $this->font_size);
         $aImg->SetTextAlign("left", "top");
         $aImg->StrokeText(round($x1 + $this->mark_abs_hsize + $this->xmargin), $y1, $p[0]);
         if ($p[4] != "") {
             $xe = $x1 + $this->xmargin + $this->mark_abs_hsize + $aImg->GetTextWidth($p[0]);
             $ye = $y1 + max($this->mark_abs_vsize, $aImg->GetTextHeight($p[0]));
             $coords = "{$x1},{$y1},{$xe},{$y1},{$xe},{$ye},{$x1},{$ye}";
             if (!empty($p[4])) {
                 $this->csimareas .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . htmlentities($p[4]) . "\"";
                 if (!empty($p[6])) {
                     $this->csimareas .= " target=\"" . $p[6] . "\"";
                 }
                 if (!empty($p[5])) {
                     $tmp = sprintf($p[5], $p[0]);
                     $this->csimareas .= " title=\"{$tmp}\" alt=\"{$tmp}\" ";
                 }
                 $this->csimareas .= " />\n";
             }
         }
         if ($i >= $this->layout_n) {
             $x1 = $xp + $this->mark_abs_hsize + $this->xlmargin;
             $y1 += $rowheight[$row++];
             $i = 1;
         } else {
             $x1 += $colwidth[($i - 1) % $numcolumns];
             ++$i;
         }
     }
 }
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:101,代码来源:jpgraph.php

示例14: Stroke

 function Stroke($aImg, $aScale)
 {
     $factory = new RectPatternFactory();
     $prect = $factory->Create($this->iPattern, $this->iPatternColor);
     $prect->SetDensity($this->iPatternDensity);
     // If height factor is specified as a float between 0,1 then we take it as meaning
     // percetage of the scale width between horizontal line.
     // If it is an integer > 1 we take it to mean the absolute height in pixels
     if ($this->iHeightFactor > -0.0 && $this->iHeightFactor <= 1.1) {
         $vs = $aScale->GetVertSpacing() * $this->iHeightFactor;
     } elseif (is_int($this->iHeightFactor) && $this->iHeightFactor > 2 && $this->iHeightFactor < 200) {
         $vs = $this->iHeightFactor;
     } else {
         JpGraphError::Raise("Specified height (" . $this->iHeightFactor . ") for gantt bar is out of range.");
     }
     // Clip date to min max dates to show
     $st = $aScale->NormalizeDate($this->iStart);
     $en = $aScale->NormalizeDate($this->iEnd);
     $limst = max($st, $aScale->iStartDate);
     $limen = min($en, $aScale->iEndDate + SECPERDAY);
     $xt = $aScale->TranslateDate($limst);
     $xb = $aScale->TranslateDate($limen) - 1;
     $yt = $aScale->TranslateVertPos($this->iVPos) - $vs - ($aScale->GetVertSpacing() / 2 - $vs / 2);
     $yb = $aScale->TranslateVertPos($this->iVPos) - ($aScale->GetVertSpacing() / 2 - $vs / 2);
     $middle = round($yt + ($yb - $yt) / 2);
     $this->title->Stroke($aImg, $aImg->left_margin + $this->iLabelLeftMargin, $middle);
     // Check if the bar is outside the current range
     if ($en < $aScale->iStartDate + SECPERDAY || $st > $aScale->iEndDate) {
         return;
     }
     $prect->ShowFrame(false);
     $prect->SetBackground($this->iFillColor);
     if ($this->iShadow) {
         $aImg->SetColor($this->iFrameColor);
         $aImg->ShadowRectangle($xt, $yt, $xb, $yb, $this->iFillColor, $this->iShadowWidth, $this->iShadowColor);
         $prect->SetPos(new Rectangle($xt + 1, $yt + 1, $xb - $xt - $this->iShadowWidth - 2, $yb - $yt - $this->iShadowWidth - 2));
         $prect->Stroke($aImg);
     } else {
         $prect->SetPos(new Rectangle($xt, $yt, $xb - $xt + 1, $yb - $yt + 1));
         $prect->Stroke($aImg);
         $aImg->SetColor($this->iFrameColor);
         $aImg->Rectangle($xt, $yt, $xb, $yb);
     }
     if ($this->progress->iProgress > 0) {
         //echo "test <p>";
         $xtp = $aScale->TranslateDate($st);
         $xbp = $aScale->TranslateDate($en);
         $len = ($xbp - $xtp) * $this->progress->iProgress;
         $endpos = $xtp + $len;
         if ($endpos > $xt) {
             $len -= $xt - $xtp;
             //echo "diff in days : ".(($xt-$xtp)/$aScale->GetDayWidth())."<p>";
             //echo "xtp=$xtp, len=$len, xt=$xt<p>";
             if ($xtp < $xt) {
                 $xtp = $xt;
             }
             $prog = $factory->Create($this->progress->iPattern, $this->progress->iColor);
             $prog->SetDensity($this->progress->iDensity);
             $barheight = $yb - $yt + 1;
             if ($this->iShadow) {
                 $barheight -= $this->iShadowWidth;
             }
             $progressheight = floor($barheight * $this->progress->iHeight);
             $marg = ceil(($barheight - $progressheight) / 2);
             $pos = new Rectangle($xtp, $yt + $marg, $len, $barheight - 2 * $marg);
             $prog->SetPos($pos);
             $prog->Stroke($aImg);
         }
     }
     // We don't plot the end mark if the bar has been capped
     if ($limst == $st) {
         $this->leftMark->Stroke($aImg, $xt, $middle);
     }
     if ($limen == $en) {
         $this->rightMark->Stroke($aImg, $xb, $middle);
         $margin = $this->iCaptionMargin;
         if ($this->rightMark->show) {
             $margin += $this->rightMark->GetWidth();
         }
         $this->caption->Stroke($aImg, $xb + $margin, $middle);
     }
 }
开发者ID:teammember8,项目名称:roundcube,代码行数:82,代码来源:jpgraph_gantt.php

示例15: Stroke

 function Stroke($aImg, $aScale)
 {
     $factory = new RectPatternFactory();
     $prect = $factory->Create($this->iPattern, $this->iPatternColor);
     $prect->SetDensity($this->iPatternDensity);
     // If height factor is specified as a float between 0,1 then we take it as meaning
     // percetage of the scale width between horizontal line.
     // If it is an integer > 1 we take it to mean the absolute height in pixels
     if ($this->iHeightFactor > -0.0 && $this->iHeightFactor <= 1.1) {
         $vs = $aScale->GetVertSpacing() * $this->iHeightFactor;
     } elseif (is_int($this->iHeightFactor) && $this->iHeightFactor > 2 && $this->iHeightFactor < 200) {
         $vs = $this->iHeightFactor;
     } else {
         JpGraphError::Raise("<b>JpGraph Error:</b>Specified height (" . $this->iHeightFactor . ") for gantt bar is out of range.");
     }
     $xt = $aScale->TranslateDate($aScale->NormalizeDate($this->iStart));
     $xb = $aScale->TranslateDate($aScale->NormalizeDate($this->iEnd));
     $yt = $aScale->TranslateVertPos($this->iVPos) - $vs - ($aScale->GetVertSpacing() / 2 - $vs / 2);
     $yb = $aScale->TranslateVertPos($this->iVPos) - ($aScale->GetVertSpacing() / 2 - $vs / 2);
     $prect->ShowFrame(false);
     $prect->SetBackground($this->iFillColor);
     if ($this->iShadow) {
         $aImg->SetColor($this->iFrameColor);
         $aImg->ShadowRectangle($xt, $yt, $xb, $yb, $this->iFillColor, $this->iShadowWidth, $this->iShadowColor);
         $prect->SetPos(new Rectangle($xt + 1, $yt + 1, $xb - $xt - $this->iShadowWidth - 2, $yb - $yt - $this->iShadowWidth - 2));
         $prect->Stroke($aImg);
     } else {
         $prect->SetPos(new Rectangle($xt, $yt, $xb - $xt + 1, $yb - $yt + 1));
         $prect->Stroke($aImg);
         $aImg->SetColor($this->iFrameColor);
         $aImg->Rectangle($xt, $yt, $xb, $yb);
     }
     if ($this->progress->iProgress > 0) {
         $prog = $factory->Create($this->progress->iPattern, $this->progress->iColor);
         $prog->SetDensity($this->progress->iDensity);
         $barheight = $yb - $yt + 1;
         if ($this->iShadow) {
             $barheight -= $this->iShadowWidth;
         }
         $progressheight = floor($barheight * $this->progress->iHeight);
         $marg = ceil(($barheight - $progressheight) / 2);
         $pos = new Rectangle($xt, $yt + $marg, ($xb - $xt + 1) * $this->progress->iProgress, $barheight - 2 * $marg);
         $prog->SetPos($pos);
         $prog->Stroke($aImg);
     }
     $middle = round($yt + ($yb - $yt) / 2);
     $this->title->Stroke($aImg, $aImg->left_margin + $this->iLabelLeftMargin, $middle);
     $this->leftMark->Stroke($aImg, $xt, $middle);
     $this->rightMark->Stroke($aImg, $xb, $middle);
     $margin = $this->iCaptionMargin;
     if ($this->rightMark->show) {
         $margin += $this->rightMark->GetWidth();
     }
     $this->caption->Stroke($aImg, $xb + $margin, $middle);
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:55,代码来源:jpgraph_gantt.php


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