19declare(strict_types=1);
24use ILIAS\UI\Implementation\Component\ComponentHelper;
30class Bar implements C\Chart\Bar\Bar
52 public function __construct(
string $title,
Dataset $dataset, array $bar_configs = [], array $group_configs = [])
54 $this->title = $title;
56 throw new \LogicException(
57 "Dataset must not be empty."
64 throw new \InvalidArgumentException(
65 "Expected parameter to be a CardinalDimension or RangeDimension."
69 $this->dataset = $dataset;
71 $this->bar_configs = $bar_configs;
72 $this->group_configs = $group_configs;
78 $clone->title = $title;
90 $clone->dataset = $dataset;
96 return $this->dataset;
101 $clone = clone $this;
102 $clone->bar_configs = $bar_configs;
108 return $this->bar_configs;
113 $clone = clone $this;
114 $clone->group_configs = $group_configs;
120 return $this->group_configs;
125 $clone = clone $this;
126 $clone->title_visible = $title_visible;
132 return $this->title_visible;
137 $clone = clone $this;
138 $clone->legend_visible = $legend_visible;
144 return $this->legend_visible;
149 if (!in_array($legend_position, self::ALLOWED_POSITIONS)) {
150 throw new \InvalidArgumentException(
151 "Position must be 'bottom', 'top', 'left' or 'right'."
154 $clone = clone $this;
155 $clone->legend_position = $legend_position;
161 return $this->legend_position;
166 $clone = clone $this;
167 $clone->tooltips_visible = $tooltips_visible;
173 return $this->tooltips_visible;
withLegendPosition(string $legend_position)
__construct(string $title, Dataset $dataset, array $bar_configs=[], array $group_configs=[])
withTitleVisible(bool $title_visible)
withDataset(Dataset $dataset)
withTooltipsVisible(bool $tooltips_visible)
withBarConfigs(array $bar_configs)
withLegendVisible(bool $legend_visible)
withGroupConfigs(array $group_configs)
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.