forked from loadavg/loadavg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchartmodule.php
105 lines (77 loc) · 2.76 KB
/
chartmodule.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
102
103
104
105
<?php
/**
* LoadAvg - Server Monitoring & Analytics
* http://www.loadavg.com
*
* MySQL charts derived from views/chart.php
*
* @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.
*/
?>
<?php
$tableStyle = ( isset( $chartData['chart']['chart_avg'] ) ) ? 'span8' : 'span9';
//dirty hack
if ($drawAvg == false)
$tableStyle = 'span9';
//used to hide data on mobile devices
$hidden = false;
if ( LoadAvg::$isMobile == true )
$hidden = true;
//echo 'tableStyle ' . $tableStyle . '<br>';
?>
<table id = "chartTable<?php echo strtok($moduleSettings['module']['name'], " "); ?>" border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<!-- Now we render the chart -->
<!-- this sections renders out chart left legend from .ini file -->
<?php if ( $drawLegend ) { ?>
<!--
<td class="hidden-phone hidden-tablet" width="26%" align="right" style="padding-right: 15px;">
-->
<td class="<?php if ($hidden) echo 'hidden'; ?>" width="26%" align="right" style="padding-right: 15px;">
<?php include( HOME_PATH . '/lib/charts/legend.php'); ?>
</td>
<?php } ?>
<!-- this sections renders main chart area -->
<td id = "chartTd<?php echo strtok($moduleSettings['module']['name'], " "); ?>" width="65%" class="<?php echo $tableStyle ?> innerT" >
<?php
if ( $loadJavascript) {
?>
<script type="text/javascript" src= "<?php echo SCRIPT_ROOT; ?>lib/modules/<?php echo $module; ?>/<?php echo strtolower($module); ?>.js"></script>
<?php }
//draw chart
include( HOME_PATH . '/lib/charts/chartcore.php');
?>
</td>
<?php
// Now draw separate chart for mean value display stacked bar chart
// cool as we can also do pie charts etc using different flags
if ( isset($chartData['chart']['chart_avg']) && ($drawAvg == true) ) {
//$chartMode = $chartData['chart']['chart_avg'];
$chartMode = (isset($chartData['chart']['chart_avg']) ? $chartData['chart']['chart_avg'] : null);
?>
<!--
<td class="span1 hidden-phone hidden-tablet" style="height: 170px">
-->
<td class="span1 <?php if ($hidden) echo 'hidden'; ?>" width="10%">
<?php
switch ( $chartMode) {
case "avg": include( HOME_PATH . '/lib/charts/chartavg.php');
break;
case "stack": include( HOME_PATH . '/lib/charts/chartstack.php');
break;
default: include( HOME_PATH . '/lib/charts/chartavg.php');
break;
}
?>
</td>
<?php
}
?>
</tr>
</table>