Naked.php 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /*
  3. Naked: Naked and easy!
  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,4,3,2,3,3,2,1,0,7,4,3,2,3,3,5,1,0,7));
  11. $DataSet->AddSerie();
  12. $DataSet->SetSerieName("Sample data","Serie1");
  13. // Initialise the graph
  14. $Test = new pChart(700,230);
  15. $Test->setFontProperties("Fonts/tahoma.ttf",10);
  16. $Test->setGraphArea(40,30,680,200);
  17. $Test->drawGraphArea(252,252,252,TRUE);
  18. $Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2);
  19. $Test->drawGrid(4,TRUE,230,230,230,70);
  20. // Draw the line graph
  21. $Test->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
  22. $Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),3,2,255,255,255);
  23. // Finish the graph
  24. $Test->setFontProperties("Fonts/tahoma.ttf",8);
  25. $Test->drawLegend(45,35,$DataSet->GetDataDescription(),255,255,255);
  26. $Test->setFontProperties("Fonts/tahoma.ttf",10);
  27. $Test->drawTitle(60,22,"My pretty graph",50,50,50,585);
  28. $Test->Render("Naked.png");