ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
base.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
7 function base()
8 {
9  //Loading factories
10  global $DIC;
11  $f = $DIC->ui()->factory();
12  $df = new \ILIAS\Data\Factory();
13  $renderer = $DIC->ui()->renderer();
14 
15  //Generating Dimensions
16  $c_dimension = $df->dimension()->cardinal();
17 
18  //Generating Dataset with points
19  $dataset = $df->dataset(["Dataset" => $c_dimension]);
20 
21  $dataset = $dataset->withPoint("Item 1", ["Dataset" => 3]);
22  $dataset = $dataset->withPoint("Item 2", ["Dataset" => 1.5]);
23  $dataset = $dataset->withPoint("Item 3", ["Dataset" => 0]);
24  $dataset = $dataset->withPoint("Item 4", ["Dataset" => 2.8]);
25  $dataset = $dataset->withPoint("Item 5", ["Dataset" => -2]);
26  $dataset = $dataset->withPoint("Item 6", ["Dataset" => 2.2]);
27  $dataset = $dataset->withPoint("Item 7", ["Dataset" => 1]);
28  $dataset = $dataset->withPoint("Item 8", ["Dataset" => -1.75]);
29 
30  //Generating and rendering the horizontal chart
31  $bar_chart = $f->chart()->bar()->horizontal(
32  "A horizontal bar chart",
33  $dataset
34  );
35 
36  // render
37  return $renderer->render($bar_chart);
38 }
global $DIC
Definition: feed.php:28