Beispiel #1
0
 public function testLabels()
 {
     // Dataset definition
     $DataSet = new pData();
     $DataSet->addPoints(array(0, 70, 70, 0, 0, 70, 70, 0, 0, 70), "Serie1");
     $DataSet->addPoints(array(0.5, 2, 4.5, 8, 12.5, 18, 24.5, 32, 40.5, 50), "Serie2");
     $DataSet->AddAllSeries();
     $DataSet->SetAbscissaLabelSeries();
     $DataSet->SetSeriesName("January", "Serie1");
     $DataSet->SetSeriesName("February", "Serie2");
     // Initialise the graph
     $canvas = new TestCanvas();
     $Test = new pChart(700, 230, $canvas);
     $Test->setFontProperties("Fonts/tahoma.ttf", 8);
     $Test->setGraphArea(50, 30, 585, 200);
     $backgroundStyle = new BackgroundStyle(new Color(255), TRUE);
     $Test->drawGraphBackground($backgroundStyle);
     $Test->drawScale($DataSet, ScaleStyle::DefaultStyle(), 0, 2);
     $Test->drawGrid(new GridStyle(4, TRUE, new Color(230), 50));
     // Draw the 0 line
     $Test->setFontProperties("Fonts/tahoma.ttf", 6);
     $Test->drawTreshold(0, new Color(143, 55, 72), TRUE, TRUE);
     // Draw the line graph
     $Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
     $Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, new Color(255));
     // Set labels
     $Test->setFontProperties("Fonts/tahoma.ttf", 8);
     $Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1", "2", "Daily incomes", new Color(221, 230, 174));
     $Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie2", "6", "Production break", new Color(239, 233, 195));
     // Finish the graph
     $Test->setFontProperties("Fonts/tahoma.ttf", 8);
     $Test->drawLegend(600, 30, $DataSet->GetDataDescription(), new Color(255));
     $Test->setFontProperties("Fonts/tahoma.ttf", 10);
     $Test->drawTitle(50, 22, "Example 9", new Color(50), 585);
     $this->assertEquals('9388dd3d1a53242b48d730c9256cf03e', md5($canvas->getActionLog()));
 }
$DataSet->AddPoint(array(0, 70, 70, 0, 0, 70, 70, 0, 0, 70), "Serie1");
$DataSet->AddPoint(array(0.5, 2, 4.5, 8, 12.5, 18, 24.5, 32, 40.5, 50), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 585, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Set labels
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1", "2", "Daily incomes", 221, 230, 174);
$Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie2", "6", "Production break", 239, 233, 195);
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, "Example 9", 50, 50, 50, 585);
$Test->Render("example9.png");
Beispiel #3
0
} elseif ($_GET['gtype'] == 'fcurve') {
    $Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 20, FALSE);
} else {
}
//---------------------------- Labels
if ($labels) {
    if ($p != '' && $n1 != "") {
        $h = count($hours);
        for ($i = $h / 2; $i > 0; $i--) {
            if ($hours[$i] != 0) {
                $r = $hours[$i];
            }
        }
    }
    if ($middleall = 0) {
        $Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1", $r, $n1, 221, 230, 174);
        if ($p2 != '' && $n2 != "") {
            $Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie2", $r, $n2, 221, 230, 174);
        }
        if ($p3 != '' && $n3 != "") {
            $Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie3", $r, $n3, 221, 230, 174);
        }
        if ($p4 != '' && $n4 != "") {
            $Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie4", $r, $n4, 221, 230, 174);
        }
        if ($p5 != '' && $n5 != "") {
            $Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie5", $r, $n5, 221, 230, 174);
        }
        if ($p6 != '' && $n6 != "") {
            $Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie6", $r, $n6, 221, 230, 174);
        }
Beispiel #4
0
 $Test->setGraphArea(60, 30, 650, 150);
 $Test->drawFilledRoundedRectangle(7, 7, 708, 223, 5, 240, 240, 240);
 $Test->drawRoundedRectangle(5, 5, 710, 225, 5, 163, 203, 167);
 $Test->drawGraphArea(255, 255, 255, TRUE);
 $Test->drawGraphAreaGradient(163, 203, 167, 50);
 $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_DIFF, 150, 150, 150, TRUE, 75, 0, FALSE, $skip_scale);
 $Test->drawGrid(4, TRUE, 230, 230, 230, 40);
 // Draw the graph
 $Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
 if ($scale_hours <= 48) {
     $Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 2, 1, 255, 255, 255);
 }
 // Draw labels
 if (!empty($ccities)) {
     foreach ($ccities as $k => $v) {
         $Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "points", $k, "Städte: {$v}", 239, 233, 195);
     }
 }
 $Test->clearShadow();
 // Clear the scale
 $Test->clearScale();
 // Draw the 2nd graph
 $DataSet->RemoveSerie("points");
 $DataSet->AddSerie("rank");
 $DataSet->SetYAxisName("Rank");
 $Test->drawRightScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_DIFF, 150, 150, 150, TRUE, 75, 0, FALSE, $skip_scale, TRUE);
 // Draw the 0 line
 $Test->setFontProperties("../charts/Fonts/tahoma.ttf", 6);
 $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
 // Draw the Line graph
 $Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 20);
Beispiel #5
0
$Chart = new pChart(700, 230, $Canvas);
// Dataset
$DataSet->AddPoints(array(0, 70, 70, 0, 0, 70, 70, 0, 0, 70), "Serie1");
$DataSet->AddPoints(array(0.5, 2, 4.5, 8, 12.5, 18, 24.5, 32, 40.5, 50), "Serie2");
$DataSet->AddAllSeries();
$DataSet->setAbscissaLabelSeries();
$DataSet->SetSeriesName("January", "Serie1");
$DataSet->SetSeriesName("February", "Serie2");
// Initialise the graph
$Chart->setFontProperties("../Fonts/tahoma.ttf", 8);
$Chart->setGraphArea(50, 30, 585, 200);
$Chart->drawGraphBackground(new BackgroundStyle(new Color(255), TRUE));
$Chart->drawScale($DataSet, ScaleStyle::DefaultStyle(), 0, 2);
$Chart->drawGrid(new GridStyle(4, TRUE, new Color(230), 50));
// Draw the 0 line
$Chart->setFontProperties("../Fonts/tahoma.ttf", 6);
$Chart->drawTreshold(0, new Color(143, 55, 72), TRUE, TRUE);
// Draw the line graph
$Chart->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Chart->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, new Color(255));
// Set labels
$Chart->setFontProperties("../Fonts/tahoma.ttf", 8);
$Chart->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1", "2", "Daily incomes", new Color(221, 230, 174));
$Chart->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie2", "6", "Production break", new Color(239, 233, 195));
// Finish the graph
$Chart->drawLegend(600, 30, $DataSet->GetDataDescription(), new Color(255));
$Chart->setFontProperties("../Fonts/tahoma.ttf", 10);
$Chart->drawTitle(50, 22, "Example 9", new Color(50), 585);
$Chart->Render("Example9.png");
header("Content-Type:image/png");
readfile("Example9.png");