ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
base.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
13 function base()
14 {
15  //Loading factories
16  global $DIC;
17  $f = $DIC->ui()->factory();
18  $df = new \ILIAS\Data\Factory();
19  $renderer = $DIC->ui()->renderer();
20 
21  //Generating Dimensions
22  $c_dimension = $df->dimension()->cardinal();
23 
24  //Generating Dataset with points
25  $dataset = $df->dataset(["Dataset" => $c_dimension]);
26 
27  $dataset = $dataset->withPoint("Item 1", ["Dataset" => 3]);
28  $dataset = $dataset->withPoint("Item 2", ["Dataset" => 1.5]);
29  $dataset = $dataset->withPoint("Item 3", ["Dataset" => 0]);
30  $dataset = $dataset->withPoint("Item 4", ["Dataset" => 2.8]);
31  $dataset = $dataset->withPoint("Item 5", ["Dataset" => -2]);
32  $dataset = $dataset->withPoint("Item 6", ["Dataset" => 2.2]);
33  $dataset = $dataset->withPoint("Item 7", ["Dataset" => 1]);
34  $dataset = $dataset->withPoint("Item 8", ["Dataset" => -1.75]);
35 
36  //Generating and rendering the horizontal chart
37  $bar_chart = $f->chart()->bar()->horizontal(
38  "A horizontal bar chart",
39  $dataset
40  );
41 
42  // render
43  return $renderer->render($bar_chart);
44 }
$renderer
global $DIC
Definition: shib_login.php:25
base()
expected output: > ILIAS shows a rendered horizontal bar chart with a title, legend and different ba...
Definition: base.php:13