ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilChartDataBars.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 $line_width; // [int]
16  protected $bar_width; // [float] bar
17  protected $bar_align; // [string] bar
18  protected $bar_horizontal; // [bool] bar
19 
20  protected function getTypeString()
21  {
22  return "bars";
23  }
24 
30  public function setLineWidth($a_value)
31  {
32  $this->line_width = (int)$a_value;
33  }
34 
40  public function getLineWidth()
41  {
42  return $this->line_width;
43  }
44 
52  public function setBarOptions($a_width, $a_align = "center", $a_horizontal = false)
53  {
54  $this->bar_width = (float)str_replace(",", ".", $a_width);
55  if(in_array((string)$a_align, array("center", "left")))
56  {
57  $this->bar_align = (string)$a_align;
58  }
59  $this->bar_horizontal = (bool)$a_horizontal;
60  }
61 
62  protected function parseDataOptions(array &$a_options)
63  {
64  $width = $this->getLineWidth();
65  if($width !== null)
66  {
67  $a_options["lineWidth"] = $width;
68  }
69 
70  if($this->bar_width)
71  {
72  $a_options["barWidth"] = $this->bar_width;
73  $a_options["align"] = $this->bar_align;
74  if($this->bar_horizontal)
75  {
76  $a_options["horizontal"] = true;
77  }
78  }
79  }
80 }
81 
82 ?>