0) { $brokenness = round(100 * ($ligne['n4'] - $ligne['n46']) / $ligne['n'], 1) ; } else { $brokenness = 0 ; } if ($count ++ % $labelinterval == 0) $data[]=array($ligne['date'], $brokenness) ; else $data[]=array('', $brokenness) ; } $plot =& new PHPlot(1024, 700); $plot->SetImageBorderType('plain'); $plot->SetPlotType('lines'); $plot->SetDataType('text-data'); $plot->SetDataValues($data); $plot->SetLineWidths(3) ; // Set enough different colors; $plot->SetDataColors(array('red', 'blue', 'green', 'orange', 'cyan', 'magenta', 'brown', 'lavender', 'pink', 'gray', 'yellow')); # Main plot title: $plot->SetTitle($title); $plot->SetYTitle("% of broken customers") ; $plot->SetXLabelAngle(90) ; $plot->SetDrawDashedGrid(true) ; # Legend # $plot->SetLegend(array("Allocated","Alive","Announced individually","Announced as aggregated")) ; # Make sure Y axis starts at 0: $plot->SetPlotAreaWorld(NULL, 0, NULL, NULL); # Labels $plot->SetXTickIncrement($labelinterval); // One tick every week $plot->SetXTickLabelPos('none') ; $plot->SetDrawXGrid(true) ; $plot->SetDrawYGrid(true) ; $plot->SetIsInline(true) ; $plot->DrawGraph(); ?>