forked from loadavg/loadavg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchartstack.php
101 lines (83 loc) · 2.53 KB
/
chartstack.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* LoadAvg - Server Monitoring & Analytics
* http://www.loadavg.com
*
* Charting core for LoadAvg included by charts.php
* used in main charts and override modules
*
* @version SVN: $Id$
* @link https://github.com/loadavg/loadavg
* @author Karsten Becker
* @copyright 2014 Sputnik7
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
?>
<script type="text/javascript">
(function () {
var myData = [
{ color:'#8ec657', data: [ [1, <?php echo $chartData['chart']['variables']['ssh_accept']; ?> ] ]},
{ color:'#c65757', data: [ [1, <?php echo $chartData['chart']['variables']['ssh_failed']; ?> ] ]},
{ color:'#ebc824', data: [ [1, <?php echo $chartData['chart']['variables']['ssh_invalid']; ?> ] ]}
];
var myTotal = <?php echo $chartData['chart']['variables']['ssh_accept']; ?> +
<?php echo $chartData['chart']['variables']['ssh_failed']; ?> +
<?php echo $chartData['chart']['variables']['ssh_invalid']; ?>;
var options = {
grid: {
show: true,
color: "#efefef",
axisMargin: 0,
borderWidth: 1,
hoverable: true,
autoHighlight: true,
borderColor: "#797979",
backgroundColor : "#353535"
},
series: {
stack: true,
bars: {
show: true,
barWidth: 1,
fill: 0.8,
align: "center"
},
color: "#26ADE4"
},
width: 0.5,
xaxis: {
show: false,
min: 1
},
yaxis: {
show: false,
max: myTotal,
min: 0,
reserveSpace: false,
labelWidth: 15
},
legend: {
show: false
},
tooltip: true,
tooltipOpts: {
content: function(label, xval, yval, flotItem) {
return "Total " + yval;
},
shifts: {
x: 20,
y: -20
},
defaultTheme: false
},
};
$(function () {
$("#minmax_<?php echo $chart->id; ?>").width(35).height(140);
$.plot($("#minmax_<?php echo $chart->id; ?>"),myData ,options);
})
})();
</script>
<div id="minmax_<?php echo $chart->id; ?>" style="width:35px;height:140px;top: 18px;right: 5px;"></div>
<div style="position: relative; top: 13px;font-size: 11px;left: 3px;">Sum</div>