-
Notifications
You must be signed in to change notification settings - Fork 3
/
chart.php
99 lines (78 loc) · 2.6 KB
/
chart.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
<?php
/* Copyright 2012 Bryan Nielsen <[email protected]>
*
* This file is part of Simple SPC.
*
* Simple SPC is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Simple SPC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Simple SPC. If not, see <http://www.gnu.org/licenses/>.
*
*/
include 'config.php';
// allow only operator permissions
include HEADERS . 'operator_header.php';
// metric object needed for the metric selection form
$metric = new Metric;
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<title>Charts</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<?php include 'fragments/controlchart_resources.php'; ?>
<script type="text/javascript">
$(document).ready(function() {
$('form#view_chart').find('select[name="Name"]').change(function() {
viewChart();
});
});
// view the selected chart
function viewChart() {
// get selected chart name
chartName = $('form#view_chart').find('select[name="Name"]').val();
// if we have a name then load the chart
if( chartName.length > 0 ) {
// get chart details
charturl = 'dataJSON.php?action=ChartData&Name=' + chartName;
chartTitle = 'Control Chart: ' + chartName;
// load the chart
$('#chart2').controlchart({'chartURL': charturl, 'chartTitle': chartTitle});
}
else {
$('#chart_description').html('No chart selected');
}
}
</script>
</head>
<body>
<?php include 'fragments/menu.php'; ?>
<div id="content">
<form method="post" id="view_chart">
<table>
<tr><td>Metric Name: </td>
<td><select name="Name">
<option value="">Select Metric</option>
<?php echo $metric->metricOptions((!empty($_REQUEST['Name']) ? $_REQUEST['Name'] : NULL)); ?>
</select></td></tr>
<tr><td></td><td><input type="button" name="view_chart" value="View Chart" onclick="viewChart(); return false;"></td></tr>
</table>
</form>
<div id="chart2" class="control_chart"></div>
<div id="chart_description"></div>
<div id="violation_messages"></div>
</div>
<?php include 'fragments/footer.php'; ?>
</body>
</html>