|
9 | 9 | - Show charts made with ChartJS
|
10 | 10 | - Account Management
|
11 | 11 | - Each user gets an account, also called group
|
12 |
| - - This account can have |
| 12 | + - This account can have multiple devices |
13 | 13 | - Device Management
|
| 14 | + - Add, edit and delete devices |
14 | 15 |
|
15 | 16 | ## Install on server
|
16 | 17 | This is a docker project, so it you will need docker to run it.
|
@@ -67,4 +68,33 @@ One may use any device of an account.
|
67 | 68 | 2. Fill in `Server URL, Account Name, Device Name, Device Token` between `APIClient( ... );` as stated in the file
|
68 | 69 | 3. One may change the `$destPath`, it has to be any empty directory (or it will be created).
|
69 | 70 | 4. Run `php ./imexport/export.php`
|
70 |
| -5. The data for all devices will show up in `$destPath` |
| 71 | +5. The data for all devices will show up in `$destPath` |
| 72 | + |
| 73 | +## Custom Graphs |
| 74 | +It is possible to create custom graph-views for the stats view. |
| 75 | + |
| 76 | +### Create your own stats function |
| 77 | +> See an example e.g. [PieCategory](https://github.com/KIMB-technologies/TaskTimeTerminateServer/blob/master/php/load/graphs/PieCategory.js) |
| 78 | +
|
| 79 | +When the user selects a graph and clicks on *Display Graph* the corresponding JS-file is loaded and the the function `createGraph(data, canvas)` |
| 80 | +of this file will be executed. In a file like [PieCategory](https://github.com/KIMB-technologies/TaskTimeTerminateServer/blob/master/php/load/graphs/PieCategory.js) |
| 81 | +such function like `createGraph(data, canvas)` can be defined. |
| 82 | + |
| 83 | +Each function gets two parameters `data` which is an array containing objects with datasets. |
| 84 | +The object `canvas` is a connector to the canvas on the page, where the chart should show up. |
| 85 | +It can be directly used with `new Chart(canvas, chartData)`. |
| 86 | + |
| 87 | +The function *must* return the created `Chart` object, cause the stats page need access to it. |
| 88 | +So a typical wokflow will use `data` to generate a object `chartData` for ChartJS and |
| 89 | +end with `return new Chart(canvas, chartData);`. |
| 90 | + |
| 91 | +For information how to create charts see https://www.chartjs.org/ (also jQuery is loaded in the DOM as `$`). |
| 92 | + |
| 93 | +### Upload to server |
| 94 | +All JS file creating charts (and containing exactly one `createGraph`) have to be placed in the folder |
| 95 | +`/php-code/load/graphs/` inside the docker-container. Using docker-compose one might add |
| 96 | +`./charts/:/php-code/load/graphs/` to the `volumes` section of the `docker-compose.yml` and |
| 97 | +add all file to `./charts/`. |
| 98 | + |
| 99 | +All JS file should be named like this `<GraphName>.js`. Of course it it recommended to |
| 100 | +use only `A-Za-z-9` for the `GraphName`. |
0 commit comments