SmallStacked.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /*
  3. Example21 : A single stacked bar graph
  4. */
  5. // Standard inclusions
  6. include("src/pData.php");
  7. include("src/pChart.php");
  8. // Dataset definition
  9. $DataSet = new pData;
  10. $DataSet->AddPoint(1,"Serie1");
  11. $DataSet->AddPoint(3,"Serie2");
  12. $DataSet->AddPoint(3,"Serie3");
  13. $DataSet->AddPoint("A#~1","Labels");
  14. $DataSet->AddAllSeries();
  15. $DataSet->RemoveSerie("Labels");
  16. $DataSet->SetAbsciseLabelSerie("Labels");
  17. $DataSet->SetSerieName("Alpha","Serie1");
  18. $DataSet->SetSerieName("Beta","Serie2");
  19. $DataSet->SetSerieName("Gama","Serie3");
  20. $DataSet->SetYAxisName("Test Marker");
  21. $DataSet->SetYAxisUnit("µm");
  22. // Initialise the graph
  23. $Test = new pChart(210,230);
  24. $Test->setFontProperties("Fonts/tahoma.ttf",8);
  25. $Test->setGraphArea(65,30,125,200);
  26. $Test->drawFilledRoundedRectangle(7,7,203,223,5,240,240,240);
  27. $Test->drawRoundedRectangle(5,5,205,225,5,230,230,230);
  28. $Test->drawGraphArea(255,255,255,TRUE);
  29. $Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_ADDALLSTART0,150,150,150,TRUE,0,2,TRUE);
  30. $Test->drawGrid(4,TRUE,230,230,230,50);
  31. // Draw the 0 line
  32. $Test->setFontProperties("Fonts/tahoma.ttf",6);
  33. $Test->drawTreshold(0,143,55,72,TRUE,TRUE);
  34. // Draw the bar graph
  35. $Test->drawStackedBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),50);
  36. // Finish the graph
  37. $Test->setFontProperties("Fonts/tahoma.ttf",8);
  38. $Test->drawLegend(135,150,$DataSet->GetDataDescription(),255,255,255);
  39. $Test->setFontProperties("Fonts/tahoma.ttf",10);
  40. $Test->drawTitle(0,22,"Sample size",50,50,50,210);
  41. $Test->Render("SmallStacked.png");