HomePage3.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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(array(1,2,5),"Serie1");
  11. $DataSet->AddPoint(array(3,2,2),"Serie2");
  12. $DataSet->AddPoint(array(3,4,1),"Serie3");
  13. $DataSet->AddPoint(array("A#~1","A#~2","A#~3"),"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->SetXAxisName("Samples IDs");
  21. $DataSet->SetYAxisName("Test Marker");
  22. $DataSet->SetYAxisUnit("µm");
  23. // Initialise the graph
  24. $Test = new pChart(380,400);
  25. $Test->drawGraphAreaGradient(90,90,90,90,TARGET_BACKGROUND);
  26. // Graph area setup
  27. $Test->setFontProperties("Fonts/pf_arma_five.ttf",6);
  28. $Test->setGraphArea(110,180,350,360);
  29. $Test->drawGraphArea(213,217,221,FALSE);
  30. $Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_ADDALLSTART0,213,217,221,TRUE,0,2,TRUE);
  31. $Test->drawGraphAreaGradient(40,40,40,-50);
  32. $Test->drawGrid(4,TRUE,230,230,230,5);
  33. // Draw the title
  34. $Test->setFontProperties("Fonts/tahoma.ttf",10);
  35. $Title = " Average growth size for selected\r\n DNA samples ";
  36. $Test->setLineStyle(2);
  37. $Test->drawLine(51,-2,51,402,0,0,0);
  38. $Test->setLineStyle(1);
  39. $Test->drawTextBox(0,0,50,400,$Title,90,255,255,255,ALIGN_BOTTOM_CENTER,TRUE,0,0,0,30);
  40. $Test->setFontProperties("Fonts/pf_arma_five.ttf",6);
  41. // Draw the bar graph
  42. $Test->drawStackedBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),70);
  43. // Second chart
  44. $DataSet->SetXAxisName("");
  45. $Test->clearScale();
  46. $Test->setGraphArea(110,20,350,140);
  47. $Test->drawGraphArea(213,217,221,FALSE);
  48. $Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_START0,213,217,221,TRUE,0,2);
  49. $Test->drawGraphAreaGradient(40,40,40,-50);
  50. $Test->drawGrid(4,TRUE,230,230,230,5);
  51. // Draw the line chart
  52. $Test->setShadowProperties(0,3,0,0,0,30,4);
  53. $Test->drawFilledCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription(),.1,40);
  54. $Test->clearShadow();
  55. // Write the legend
  56. $Test->drawLegend(-2,3,$DataSet->GetDataDescription(),0,0,0,0,0,0,255,255,255,FALSE);
  57. // Finish the graph
  58. $Test->addBorder(1);
  59. $Test->Render("HomePage2.png");