Forum Moderators: coopster
if ($select!= 'nodes_available')
{
// Create the first line
$p1 = new LinePlot($data1y);
$p1->mark->SetType(MARK_FILLEDCIRCLE);
$p1->mark->SetFillColor("red");
$p1->mark->SetWidth(4);
$p1->SetColor("red");
$p1->SetCenter();
$p1->SetLegend("Nodes Available");
$graph->Add($p1);
}
if ($select!= 'nodes_busy')
{
// Create the second line
$p2 = new LinePlot($data2y);
$p2->mark->SetType(MARK_STAR);
$p2->mark->SetFillColor("green");
$p2->mark->SetWidth(4);
$p2->SetColor("green");
$p2->SetCenter();
$p2->SetLegend("Nodes Busy");
$graph->Add($p2);
}
Please help.
you can loop through them:
$mark = array("", "FILLEDCIRCLE", "STAR", "BLA", "BALL", "BLAA")
$color = array("", "red", "green", "magenta", "black", "cyan");
$legend = array("", "Nodes Avaliable", "Nodes Busy", "bla", "alb", "bal");
for($i = 1; $i <= 5; $i++){
if($data = ${"data$i"."y"}){$p = new LinePlot($data);
$p->mark->SetType(MARK_$mark[$i]);
$p->mark->SetFillColor($color[$i]);
$p->mark->SetWidth(4);
$p->SetColor($color[$i]);
$p->SetCenter();
$p->SetLegend($legend[$i]);
$graph->Add($p);
}}
PS the empty are not processed as you have if there. but if it doesn't then correct the if to if(isset(${...}))