Fetch() public method

Fetch the content
public Fetch ( $class, $header = TRUE, $defer_js = TRUE )
 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
/**
 * Box-report generator complement, encapsulate SVGGraph handlings.
 */
function set_graph_3slices($vals, $vLabel, $is_float, $is_explode, $no_label = true, $gbox_w = 320, $gbox_h = 0)
{
    $graph_3slices = new SVGGraph($gbox_w, $gbox_h, ['label_font' => 'Georgia', 'label_font_size' => '18', 'label_colour' => '#000', 'back_colour' => 'white', 'stroke_colour' => 'rgb(180,140,140)', 'explode_amount' => 16, 'explode' => 'all', 'sort' => false]);
    $vals_out = [];
    $colours = [];
    foreach ($vals as $k => $v) {
        $label = $no_label ? '' : "{$vLabel[$k][0]} ";
        $vals_out[sprintf($is_float ? "{$label}%.1f%%" : "{$label}%s%%", $v)] = $v;
        $colours[] = $vLabel[$k][1];
    }
    $graph_3slices->Values($vals_out);
    $graph_3slices->colours = $colours;
    // sort=false to preserve colour-value matching.
    if ($is_explode) {
        $GG = $graph_3slices->Fetch('ExplodedPieGraph', false);
    } else {
        $GG = $graph_3slices->Fetch('PieGraph', false);
    }
    $GG = preg_replace('#<rect .+?/>#', '', $GG);
    return $GG;
}
Exemplo n.º 3
0
                    $p3 += 1;
                    break;
                case 4:
                    $p4 += 1;
                    break;
                case 5:
                    $p5 += 1;
                    break;
                default:
                    break;
            }
        }
        array_push($values, array("1." => $p1, "2." => $p2, "3." => $p3, "4." => $p4, "5." => $p5));
        echo "<h3 style='text-align: center;'>" . $questions[$i - 1] . "</h3>";
        $colours = array(array('#E80000', '#E80000'), array('orange', 'orange'), array('yellow', 'yellow'), array('lightgreen', 'lightgreen'), array('#39E81A', '#39E81A'));
        $graph = new SVGGraph(512, 320, $settings);
        $graph->colours = $colours;
        $graph->Values($values);
        echo $graph->Fetch('BarGraph', false) . "<hr>";
    }
} else {
    ?>
 <p> Välj vilken klass samt lärare ovan fär att se dess resultat.</p> <?php 
}
?>
			</div>
		</div>
		
	</body>
	
</html>
Exemplo n.º 4
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);
 }