Ver Fonte

make monitoring apps graph height responsive to highest percentage of array

michael mead há 8 anos atrás
pai
commit
5b0274c9a2
2 ficheiros alterados com 6 adições e 3 exclusões
  1. 6 2
      src/api/static/js/dashboard.js
  2. 0 1
      src/api/templates/dashboard.html

+ 6 - 2
src/api/static/js/dashboard.js

@@ -34,13 +34,17 @@ dashboard = {
 // monitoring apps chart
         var dataChart = {
           labels: ['24','23','22','21','20','19','18','17','16','15','14','13','12','11','10','9','8','7','6','5','4','3','2','1' ],
-          series: [cpu, memory_used, [1,2,3,50], ] // TODO: Check the order, the graph is by index not name.
+          series: [cpu, memory_used, [1,2,3,5], ] // TODO: Check the order, the graph is by index not name.
         };
 
+        dataChartArray = dataChart.series
+        var maxlist = dataChartArray.map(dataChartArray => Math.max.apply(null, dataChartArray));
+        maxNum = Math.max.apply(null, maxlist)
+
         var optionsChart = {
           lineSmooth: false,
           low: 0,
-          high: 10,
+          high: maxNum + 1,
           showArea: true,
           height: "245px",
           axisX: {

+ 0 - 1
src/api/templates/dashboard.html

@@ -301,7 +301,6 @@
 
                                 <div class="footer">
                                     <div class="chart-legend">
-                                        <!-- confirm these three are right with new API. -->
                                         <i class="fa fa-circle text-info"></i> cpu usage
                                         <i class="fa fa-circle text-warning"></i> memory used
 																				<i class="fa fa-circle text-danger"></i> available line