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