19 declare(strict_types=1);
    21 require_once(__DIR__ . 
"/../../../../../libs/composer/vendor/autoload.php");
    22 require_once(__DIR__ . 
"/../../../Base.php");
    34         return new I\Component\Chart\Bar\Factory();
    45             public function listing(): I\Component\Listing\Factory
    47                 return new I\Component\Listing\Factory();
    56         $c_dimension = $df->dimension()->cardinal();
    58         $dataset = $df->dataset([
"Dataset" => $c_dimension]);
    59         $dataset = $dataset->withPoint(
"Item", [
"Dataset" => 0]);
    68         $c_dimension = $df->dimension()->cardinal();
    69         $t_dimension = $df->dimension()->range($c_dimension);
    71         $dataset = $df->dataset([
"Dataset 1" => $c_dimension, 
"Dataset 2" => $t_dimension]);
    72         $dataset = $dataset->withPoint(
"Item 1", [
"Dataset 1" => -1.25, 
"Dataset 2" => [-2, -1]]);
    73         $dataset = $dataset->withPoint(
"Item 2", [
"Dataset 1" => null, 
"Dataset 2" => [0, 0.5]]);
    82         $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Chart\\Bar\\Factory", 
$f);
    91         $horizontal = 
$f->horizontal(
    96         $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Chart\\Bar\\Bar", $horizontal);
    97         $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Chart\\Bar\\Horizontal", $horizontal);
    99         $vertical = 
$f->vertical(
   103         $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Chart\\Bar\\Bar", $vertical);
   104         $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Chart\\Bar\\Vertical", $vertical);
   112         $c_dimension = $df->dimension()->cardinal();
   114         $dataset = $df->dataset([
"Dataset" => $c_dimension]);
   116         $this->expectException(LogicException::class);
   117         $this->expectExceptionMessage(
"Dataset must not be empty.");
   118         $horizontal = 
$f->horizontal(
   149         $horizontal = 
$f->horizontal(
   153         $horizontal1 = $horizontal->withTitle(
"Alternative title for Horizontal Bar");
   155         $this->assertEquals(
"Horizontal Bar", $horizontal->getTitle());
   156         $this->assertEquals(
"Alternative title for Horizontal Bar", $horizontal1->getTitle());
   165         $horizontal = 
$f->horizontal(
   169         $horizontal1 = $horizontal->withTitleVisible(
false);
   171         $this->assertEquals(
true, $horizontal->isTitleVisible());
   172         $this->assertEquals(
false, $horizontal1->isTitleVisible());
   181         $horizontal = 
$f->horizontal(
   185         $horizontal1 = $horizontal->withTooltipsVisible(
false);
   187         $this->assertEquals(
true, $horizontal->isTooltipsVisible());
   188         $this->assertEquals(
false, $horizontal1->isTooltipsVisible());
   197         $horizontal = 
$f->horizontal(
   201         $horizontal1 = $horizontal->withLegendVisible(
false);
   203         $this->assertEquals(
true, $horizontal->isLegendVisible());
   204         $this->assertEquals(
false, $horizontal1->isLegendVisible());
   213         $horizontal = 
$f->horizontal(
   217         $horizontal1 = $horizontal->withLegendPosition(
"left");
   219         $this->assertEquals(
"top", $horizontal->getLegendPosition());
   220         $this->assertEquals(
"left", $horizontal1->getLegendPosition());
   229         $horizontal = 
$f->horizontal(
   234         $this->expectException(InvalidArgumentException::class);
   235         $this->expectExceptionMessage(
"Position must be 'bottom', 'top', 'left' or 'right'.");
   237         $horizontal = $horizontal->withLegendPosition(
"middle");
   247         $horizontal = 
$f->horizontal(
   251         $horizontal1 = $horizontal->withDataset($e_dataset);
   253         $this->assertEquals($s_dataset, $horizontal->getDataset());
   254         $this->assertEquals($e_dataset, $horizontal1->getDataset());
   264         $bc = 
new C\Chart\Bar\BarConfig();
   265         $bc = $bc->withColor($df->color(
"#d38000"));
   271         $horizontal = 
$f->horizontal(
   275         $horizontal1 = $horizontal->withBarConfigs($bars);
   277         $this->assertEquals([], $horizontal->getBarConfigs());
   278         $this->assertEquals($bars, $horizontal1->getBarConfigs());
   288         $horizontal = 
$f->horizontal(
   293         $this->assertEquals(
"y", $horizontal->getIndexAxis());
   295         $vertical = 
$f->vertical(
   300         $this->assertEquals(
"x", $vertical->getIndexAxis());
   310         $horizontal = 
$f->horizontal(
   315         $html = 
$r->render($horizontal);
   317         $expected_html = <<<EOT
   318 <div 
class=
"il-chart-bar-horizontal">
   319     <canvas 
id=
"id_1" height=
"150px" aria-label=
"bar123" role=
"img"></canvas>
   321 <div 
class=
"sr-only">
   333         $this->
assertHTMLEquals(
"<div>" . $expected_html . 
"</div>", 
"<div>" . $html . 
"</div>");
   343         $vertical = 
$f->vertical(
   348         $html = 
$r->render($vertical);
   350         $expected_html = <<<EOT
   351 <div 
class=
"il-chart-bar-vertical">
   352     <canvas 
id=
"id_1" height=
"165px" aria-label=
"bar123" role=
"img"></canvas>
   354 <div 
class=
"sr-only">
   359                 <li>Item 1: -1.25</li>
   366                 <li>Item 1: -2 - -1</li>
   367                 <li>Item 2: 0 - 0.5</li>
   374         $this->
assertHTMLEquals(
"<div>" . $expected_html . 
"</div>", 
"<div>" . $html . 
"</div>");
 testImplementsFactoryInterface()
 
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Test on Bar Chart implementation. 
 
Class ChatMainBarProvider . 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
testWithLegendInvisible()
 
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
 
testWithTooltipsInvisible()
 
Provides common functionality for UI tests. 
 
testWithInvalidLegendPosition()