ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilChartDataSpider.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "Services/Chart/classes/class.ilChartData.php";
5 
14 {
15  protected function getTypeString()
16  {
17  return "spider";
18  }
19 
20  public function parseData(array &$a_data)
21  {
22  parent::parseData($a_data);
23 
24  $fill = $this->getFill();
25  if ($fill["color"] != "")
26  {
27  $a_data[count($a_data)-1]->color = ilChart::renderColor($fill["color"] , "0.5");
28  }
29  }
30 
31  public function parseGlobalOptions(stdClass $a_options, ilChart $a_chart)
32  {
33  $spider = new stdClass();
34  $spider->active = true;
35 
36  $spider->highlight = new stdClass();
37  $spider->highlight->mode = "line";
38 
39 
40  $spider->legs = new stdClass();
41  $spider->legs->fillStyle = ilChart::renderColor("#000", "0.7");
42  switch (count($a_chart->getLegLabels()))
43  {
44  case 4:
45  case 6:
46  $spider->legs->legStartAngle = 10;
47  break;
48 
49  default:
50  $spider->legs->legStartAngle = 0;
51  break;
52  }
53 
54  $spider->legs->data = array();
55 
56  $max_str_len = 0;
57  foreach ($a_chart->getLegLabels() as $l)
58  {
59  $l = ilUtil::shortenText ($l, 80, true);
60 
61  $label = new stdClass();
62  $label->label = $l;
63  $spider->legs->data[] = $label;
64 
65  $max_str_len = max($max_str_len, strlen($l));
66  }
67 
68  // depending on caption length
69  if ($max_str_len > 60)
70  {
71  $font_size = 10;
72  }
73  else if ($max_str_len > 30)
74  {
75  $font_size = 12;
76  }
77  else
78  {
79  $font_size = 15;
80  }
81  $spider->legs->font = $font_size."px Arial";
82 
83  $spider->spiderSize = 0.7;
84  $spider->lineWidth = 1;
85  $spider->pointSize = 0;
86 
87  $spider->connection = new StdClass();
88  $spider->connection->width = 2;
89 
90  $spider->legMin = 0.0000001;
91  $spider->legMax = $a_chart->getYAxisMax();
92 
93  $a_options->series->spider = $spider;
94  }
95 }
96 
97 ?>
Chart data spider series.
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
Abstract Chart generator base class.
getFill()
Get fill.
Create styles array
The data for the language used.
global $l
Definition: afr.php:30
static renderColor($a_value, $a_opacity=1)
Render html color code.
Abstract chart data series base class.
parseGlobalOptions(stdClass $a_options, ilChart $a_chart)