ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
4include_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 $a_data[count($a_data)-1]->color = ilChart::renderColor($fill["color"], "0.5");
27 }
28 }
29
30 public function parseGlobalOptions(stdClass $a_options, ilChart $a_chart)
31 {
32 $spider = new stdClass();
33 $spider->active = true;
34
35 $spider->highlight = new stdClass();
36 $spider->highlight->mode = "line";
37
38
39 $spider->legs = new stdClass();
40 $spider->legs->fillStyle = ilChart::renderColor("#000", "0.7");
41 switch (count($a_chart->getLegLabels())) {
42 case 4:
43 case 6:
44 $spider->legs->legStartAngle = 10;
45 break;
46
47 default:
48 $spider->legs->legStartAngle = 0;
49 break;
50 }
51
52 $spider->legs->data = array();
53
54 $max_str_len = 0;
55 foreach ($a_chart->getLegLabels() as $l) {
56 $l = ilUtil::shortenText($l, 80, true);
57
58 $label = new stdClass();
59 $label->label = $l;
60 $spider->legs->data[] = $label;
61
62 $max_str_len = max($max_str_len, strlen($l));
63 }
64
65 // depending on caption length
66 if ($max_str_len > 60) {
67 $font_size = 10;
68 } elseif ($max_str_len > 30) {
69 $font_size = 12;
70 } else {
71 $font_size = 15;
72 }
73 $spider->legs->font = $font_size . "px Arial";
74
75 $spider->spiderSize = 0.7;
76 $spider->lineWidth = 1;
77 $spider->pointSize = 0;
78
79 $spider->connection = new StdClass();
80 $spider->connection->width = 2;
81
82 $spider->legMin = 0.0000001;
83 $spider->legMax = $a_chart->getYAxisMax();
84
85 $a_options->series->spider = $spider;
86 }
87}
global $l
Definition: afr.php:30
An exception for terminatinating execution or to throw for unit testing.
Chart data spider series.
getTypeString()
Get series type.
parseGlobalOptions(stdClass $a_options, ilChart $a_chart)
Convert (global) properties to flot config.
parseData(array &$a_data)
Convert data to flot config.
Abstract chart data series base class.
getFill()
Get fill.
Abstract Chart generator base class.
static renderColor($a_value, $a_opacity=1)
Render html color code.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.