File: viewspectrum.html

package info (click to toggle)
refnx 0.1.60-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,972 kB
  • sloc: python: 37,056; cpp: 1,015; ansic: 185; makefile: 180; sh: 130; lisp: 89; xml: 34
file content (78 lines) | stat: -rw-r--r-- 2,941 bytes parent folder | download | duplicates (2)
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
<style type="text/css">
.graph {
    width:800px;
     height:600px;
}
</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 spectra", width: 800, height: 600,
                            vAxis: {title: "Intensity", logScale: form.logY.checked},
                            hAxis: {title: "lambda", logScale: form.logX.checked}});
      }
      
      function drawchart(form) {
        urltocall = "cgi-bin/viewspectrum.cgi";
		chart = null;
        
        var jsonData = $.ajax({
            url: urltocall,
            dataType:"json",
            async: false,
            type:"POST",
            data:{spectrum: form.spectrum.value,
                     rebinpercent: form.rebinpercent.value,
                         lolambda: form.lolambda.value,
                            hilambda: form.hilambda.value,
                             JSON: 1}
            }).responseText;
  
		data = null;
		
        // 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 spectra", width: 800, height: 600,
                            vAxis: {title: "Intensity", logScale: form.logY.checked},
                            hAxis: {title: "lambda", logScale: form.logX.checked}});

      }
      
 
    </script>
    </head>
<body>

        <!--Div that will hold the pie chart-->
    <div id="chart_div" class="graph"></div>
    
    <FORM NAME="myform" ACTION="cgi-bin/viewspectrum.cgi" METHOD="POST">Enter your run numbers in the box, separated by spaces: <BR>
        <INPUT TYPE="text" NAME="spectrum" 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)"/> 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>