Colours() public method

public Colours ( $colours )
 function draw_graph($type, $settings = array(), $values = array(), $colors = array(), $links = array(), $h = 300, $w = 200)
 {
     $g = new SVGGraph($w, $h, $settings);
     $g->Values($values);
     $g->Colours($colors);
     $g->Links($links);
     $img = $g->Fetch($type);
     return $img;
 }
Exemplo n.º 2
0
 /**
  * Creates the pie circle as an SVG image using SVGGraph, then imports it
  * into the pdf using TCPDF.
  * <p>
  * The x/y define the origin of where to begin drawing the svg graphic;
  * this is the upper left corner of image.
  * <p>
  * To draw the svg graphic this method calls SVGGraph->Fetch
  * <p>
  * To import the svg graphic into the pdf this method calls TCPDF->ImageSVG
  * <p>
  * ImageSVG params:
  * $file, $x='', $y='', $w=0, $h=0, $link='', $align='', $palign='',
  * 	$border=0, $fitonpage=false
  *
  * @param float $curX	the x position
  * @param float $curY	the y position
  */
 public function drawPie($curX, $curY)
 {
     // process the values and colors, to deal with a bug in SVGGraph where a value of 0
     // doesn't use a color from the list, which would cause the slices to not be the correct color
     $values = $this->pieWedgeValues;
     $colors = $this->getGraphColorsText();
     self::fixGraphValuesAndColors($values, $colors);
     /*
      Create the pie as a circle in an SVG image; width in pixels, height in pixels, settings.
      If aspect_raitio is 1.0, the smallest value controls the size; HOWEVER, the svg image itself
      is rectilinear (give it a border and this becomes visible) and will be what height and width
      you set it to, such as 100 x 200.
     */
     $graph = new SVGGraph($this->svgGraphicWidth, $this->svgGraphicHeight, $this->svgGraphSettings);
     $graph->Values($values);
     $graph->Colours($colors);
     $svg = $graph->Fetch('PieGraph');
     // This imports the svg into the PDF.
     $this->pdf->ImageSVG('@' . $svg, $curX, $curY, 0, 0, '', '', '', $this->imageSvgBorder);
 }