ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilChartDataBars.php
Go to the documentation of this file.
1<?php
2
25{
26 protected ?int $line_width = null;
27 protected float $bar_width = 0;
28 protected string $bar_align = "";
29 protected bool $bar_horizontal = false;
30
31 protected function getTypeString(): string
32 {
33 return "bars";
34 }
35
36 public function setLineWidth(int $a_value): void
37 {
38 $this->line_width = $a_value;
39 }
40
41 public function getLineWidth(): ?int
42 {
43 return $this->line_width;
44 }
45
46 public function setBarOptions(
47 float $a_width,
48 string $a_align = "center",
49 bool $a_horizontal = false
50 ): void {
51 $this->bar_width = (float) str_replace(",", ".", (string) $a_width);
52 if (in_array($a_align, array("center", "left"))) {
53 $this->bar_align = $a_align;
54 }
55 $this->bar_horizontal = $a_horizontal;
56 }
57
58 protected function parseDataOptions(array &$a_options): void
59 {
60 $width = $this->getLineWidth();
61 if ($width !== null) {
62 $a_options["lineWidth"] = $width;
63 }
64
65 if ($this->bar_width) {
66 $a_options["barWidth"] = $this->bar_width;
67 $a_options["align"] = $this->bar_align;
68 if ($this->bar_horizontal) {
69 $a_options["horizontal"] = true;
70 }
71 }
72 }
73}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setBarOptions(float $a_width, string $a_align="center", bool $a_horizontal=false)
parseDataOptions(array &$a_options)
Convert data options to flot config.
setLineWidth(int $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...