Line.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\Core\UI\Widget\Graphs;
  3. /**
  4. * Description of EmptyGraph
  5. *
  6. * @autor ThurData <info@thrudata.ch>
  7. */
  8. class Line extends EmptyGraph
  9. {
  10. protected $id = 'lineGraph';
  11. protected $name = 'lineGraph';
  12. protected function preInitContent()
  13. {
  14. //Do not use or override this method
  15. $this->setChartTypeToLine();
  16. $this->loadSettings();
  17. }
  18. public function afterInitContent()
  19. {
  20. $this->addGraphSettings();
  21. }
  22. public function prepareAjaxData()
  23. {
  24. $labels = ['day 1', 'day 2', 'day 3']; //labels on the bottom
  25. $this->setLabels($labels);
  26. //Data Set 1
  27. $dataSet1 = new Models\DataSet();
  28. $dataSet1->setTitle('Data Set 1')
  29. ->setData([1, 5, 9])
  30. ->setConfigurationDataSet([
  31. "backgroundColor" => "rgba(39, 133, 134, 0.91)",
  32. "borderColor" => "rgba(39, 133, 134, 1)"
  33. ]);
  34. $this->addDataSet($dataSet1);
  35. //Data Set 2
  36. $dataSet2 = new Models\DataSet();
  37. $dataSet2->setTitle('Data Set 2')
  38. ->setData([8, 7, 4])
  39. ->setConfigurationDataSet([
  40. "backgroundColor" => "rgba(174, 198, 57, 0.79)",
  41. "borderColor" => "rgba(174, 198, 57, 1)"
  42. ]);
  43. $this->addDataSet($dataSet2);
  44. //Data Set 3
  45. $dataSet3 = new Models\DataSet();
  46. $dataSet3->setTitle('Data Set 3')
  47. ->setData([8, 12, 6])
  48. ->setConfigurationDataSet([
  49. "backgroundColor" => "pink",
  50. "borderColor" => "red"
  51. ]);
  52. $this->addDataSet($dataSet3);
  53. }
  54. }