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
|
<style type="text/css">
.graph {
width:600px;
height:400px
}
</style>
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
//Load the Visualization API and the piechart package.
google.load('visualization', '1', {'packages':['corechart']});
</script>
<script type="text/javascript">
var data;
var chart;
function redraw(form){
chart.draw(data, {title: "Platypus reflectivity", width: 600, height: 400,
vAxis: {title: "R", logScale: form.logY.checked},
hAxis: {title: "Q", logScale: form.logX.checked}});
}
function drawchart(form) {
urltocall = "cgi-bin/reduceData.cgi"
data = null;
chart = null;
var jsonData = $.ajax({
url: urltocall,
dataType:"json",
async: false,
type:"POST",
data:{reflect_spectrum: form.reflect_spectrum.value,
direct_spectrum: form.direct_spectrum.value,
rebinpercent: form.rebinpercent.value,
lolambda: form.lolambda.value,
hilambda: form.hilambda.value,
normfilenumber: form.normfilenumber.value,
JSON: 1}
}).responseText;
// Create our data table out of JSON data loaded from server.
data = new google.visualization.DataTable(jsonData);
// Instantiate and draw our chart, passing in some options.
chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, {title: "Platypus reflectivity", width: 600, height: 400,
vAxis: {title: "R", logScale: form.logY.checked},
hAxis: {title: "Q", logScale: form.logX.checked}});
}
</script>
</head>
<body>
<div id="chart_div" class="graph"></div>
<FORM NAME="myform" ACTION="cgi-bin/reduceData.cgi" METHOD="POST">Enter your run numbers in the boxes, separated by spaces: <BR>
reflected spectra <INPUT TYPE="text" NAME="reflect_spectrum" VALUE=""><P>
direct spectra <INPUT TYPE="text" NAME="direct_spectrum" VALUE=""><P>
floodfield (single run) <INPUT TYPE="text" NAME="normfilenumber" VALUE=""><P>
rebinning percentage: <INPUT TYPE="text" NAME="rebinpercent", VALUE="4"> <P>
minimum wavelength: <INPUT TYPE="text" NAME="lolambda", VALUE="2.8"> <P>
maximum wavelength: <INPUT TYPE="text" NAME="hilambda", VALUE="18.0"> <P>
<INPUT type="checkbox" name="logY" value="1" onclick="redraw(this.form)" checked /> logY scale <P>
<INPUT type="checkbox" name="logX" value="1" onclick="redraw(this.form)"/> logX scale <P>
<INPUT TYPE="button" NAME="ViewButton" Value="View" onClick="drawchart(this.form)"/>
<INPUT TYPE='submit' value="Save spectra"/>
</FORM>
</body>
</html>
|