<?php


include('auth.php');
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_pie.php");
include ("jpgraph/jpgraph_pie3d.php");

if (!is_numeric($risk1)) { JpGraphError::Raise(" Incorrect parameter. "); }
if (!is_numeric($risk2)) { JpGraphError::Raise(" Incorrect parameter. "); }
if (!is_numeric($risk3)) { JpGraphError::Raise(" Incorrect parameter. "); }
if (!is_numeric($risk4)) { JpGraphError::Raise(" Incorrect parameter. "); }
if (!is_numeric($risk5)) { JpGraphError::Raise(" Incorrect parameter. "); }
if (!is_numeric($risk6)) { JpGraphError::Raise(" Incorrect parameter. "); }
if (!is_numeric($risk7)) { JpGraphError::Raise(" Incorrect parameter. "); }


$data = array($risk1,$risk2,$risk3,$risk4,$risk5,$risk6,$risk7);

$totalvulns=$risk1+$risk2+$risk3+$risk4+$risk5+$risk6+$risk7;
if ($totalvulns > 0) {
$graph = new PieGraph(450,200,"auto");
$graph->SetShadow();

$graph->title->Set("Vulnerabilities Found - $totalvulns");
$graph->title->SetFont(FF_FONT1,FS_BOLD);

$p1 = new PiePlot3D($data);
$p1->SetSize(0.5);
$p1->SetCenter(0.3);


$legend=array("Serious - $risk1","High - $risk2","Medium - $risk3","Medium/Low - $risk4","Low/Medium - $risk5","Low - $risk6","Info - $risk7");

$p1->SetLegends($legend);
$colors=array("red", "yellow", "magenta", "orange", "navy", "green","blue");
$p1->SetSliceColors($colors);

//$dplot[0]->SetFillColor("blue");
//$dplot[1]->SetFillColor("green");
//$dplot[2]->SetFillColor("navy");
//$dplot[3]->SetFillColor("orange");
//$dplot[4]->SetFillColor("magenta");
//$dplot[5]->SetFillColor("yellow");
//$dplot[6]->SetFillColor("red");

$graph->Add($p1);
$graph->Stroke();
}
?>


