ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
base.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
29 function base()
30 {
31  //Loading factories
32  global $DIC;
33  $f = $DIC->ui()->factory();
34  $df = new \ILIAS\Data\Factory();
35  $renderer = $DIC->ui()->renderer();
36 
37  //Generating Dimensions
38  $c_dimension = $df->dimension()->cardinal();
39 
40  //Generating Dataset with points
41  $dataset = $df->dataset(["Dataset" => $c_dimension]);
42 
43  $dataset = $dataset->withPoint("Item 1", ["Dataset" => 3]);
44  $dataset = $dataset->withPoint("Item 2", ["Dataset" => 1.5]);
45  $dataset = $dataset->withPoint("Item 3", ["Dataset" => 0]);
46  $dataset = $dataset->withPoint("Item 4", ["Dataset" => 2.8]);
47  $dataset = $dataset->withPoint("Item 5", ["Dataset" => -2]);
48  $dataset = $dataset->withPoint("Item 6", ["Dataset" => 2.2]);
49  $dataset = $dataset->withPoint("Item 7", ["Dataset" => 1]);
50  $dataset = $dataset->withPoint("Item 8", ["Dataset" => -1.75]);
51 
52  //Generating and rendering the horizontal chart
53  $bar_chart = $f->chart()->bar()->horizontal(
54  "A horizontal bar chart",
55  $dataset
56  );
57 
58  // render
59  return $renderer->render($bar_chart);
60 }
$renderer
global $DIC
Definition: shib_login.php:22
base()
expected output: > ILIAS shows a rendered horizontal bar chart with a title, legend and different ba...
Definition: base.php:29