Browse Source

Add color to levels

Kai Kretschmann 5 months ago
parent
commit
08d9ffa213
1 changed files with 12 additions and 4 deletions
  1. 12
    4
      js/lggr_stat_data.php

+ 12
- 4
js/lggr_stat_data.php View File

@@ -19,9 +19,9 @@ if (isset($_SESSION[LggrState::SESSIONNAME])) {
19 19
 } // if
20 20
 
21 21
 $aColors = array(
22
-    'emerg' => COLORALERT,
23
-    'crit' => COLORALERT,
24
-    'err' => COLORALERT,
22
+    'emerg' => '#'.COLORALERT,
23
+    'crit' => '#'.COLORALERT,
24
+    'err' => '#'.COLORALERT,
25 25
     'warning' => '#f0ad4e',
26 26
     'notice' => '#337ab7',
27 27
     'info' => '#5cb85c'
@@ -87,10 +87,18 @@ var dataLevels = {
87 87
 <?php
88 88
 foreach ($aLevels as $level) {
89 89
     $newVal = round(log($level->c));
90
-    // $newCol = $aColors[$level->level];
90
+    $newCol = $aColors[$level->level];
91 91
     echo "{$newVal}, ";
92 92
 } // foreach
93 93
 ?>
94
+        ],
95
+        backgroundColor: [
96
+<?php
97
+foreach ($aLevels as $level) {
98
+    $newCol = $aColors[$level->level];
99
+    echo "'{$newCol}', ";
100
+} // foreach
101
+?>
94 102
         ]
95 103
     }],
96 104
     labels: [

Loading…
Cancel
Save
Social stuff:
Mastodon