]> jspc29.x-matter.uni-frankfurt.de Git - coral.git/commitdiff
small changes
authorMichael Wiebusch <m.wiebusch@gsi.de>
Fri, 30 Jan 2015 10:07:59 +0000 (11:07 +0100)
committerMichael Wiebusch <m.wiebusch@gsi.de>
Fri, 30 Jan 2015 10:07:59 +0000 (11:07 +0100)
user_interface/coral_scanner.js
user_interface/coral_scanner.pm

index 2e07d289553223043bb048480b0034eefd493a82..4f8e810b7a2e5446154980d2f56e1f11b0d5771d 100644 (file)
@@ -57,6 +57,7 @@ $(document).ready(function(){
   });
   $("#button_plot_spectrum").click(function(){
     spectrum = get_spectrum_JSON();
+    plot_choices();
     plot_spectrum();
   });
   $("#button_clear_spectrum").click(function(){
@@ -97,13 +98,14 @@ $(document).ready(function(){
   });
   
   $( "#progressbar" ).progressbar({
-    value: 100
+    value: 1000
   });
   
   get_coral_scanner_settings();
   get_pmt_ro_settings();
   
   spectrum = get_spectrum_JSON();
+  plot_choices();
   plot_spectrum();
   
   get_scan_meta();
@@ -169,17 +171,48 @@ function make_flot(){
   
 }
 
+function plot_choices() {
+    // insert checkboxes 
+    var choiceContainer = $("#choices");
+    choiceContainer.html("");
+    $.each(spectrum, function(key, val) {
+      choiceContainer.append("<br/><input type='checkbox' name='" + key +
+        "' checked='checked' id='id" + key + "'></input>" +
+        "<label for='id" + key + "'>"
+        + key + "</label>");
+    });
+    
+    choiceContainer.find("input").click(function(){plot_spectrum();});
+  
+  
+}
+
+
 function plot_spectrum() {
   var data = [];
-  for (x in spectrum){
-    data.push(
-      {
-        data: spectrum[x].data,
-        bars: { show: true ,  barWidth: 0.8*parseFloat(spectrum[x].meta.bin_width), align: "center" },
-        label: x
-      }
-    );
-  }
+//   for (x in spectrum){
+//     data.push(
+//       {
+//         data: spectrum[x].data,
+//         bars: { show: true ,  barWidth: 0.8*parseFloat(spectrum[x].meta.bin_width), align: "center" },
+//         label: x
+//       }
+//     );
+//   }
+  
+  $('#choices').find("input:checked").each(function () {
+        var key = $(this).attr("name");
+        if (key && spectrum[key]) {
+//           data.push(datasets[key]);
+          data.push(
+            {
+              data: spectrum[key].data,
+              bars: { show: true ,  barWidth: 0.8*parseFloat(spectrum[key].meta.bin_width), align: "center" },
+              label: key
+            }
+          );
+        }
+      });
   
   var options = {
     selection: {
@@ -330,8 +363,8 @@ function get_scan_status(){
             $('#'+id).html(answer[id]);
           }
           $( "#progressbar" ).progressbar({
-            max: answer.rows,
-            value: answer.current_row
+            max: answer.number_points,
+            value: answer.points_scanned
           });
         }
      });
index 629954314dc424051fa924b985da885e34b0ea15..d66e5230cece8b3c0a121454f172b4770feb3296 100644 (file)
@@ -168,11 +168,15 @@ sub main_html {
   
   print "<p id='show_pmt_spectrum' class='quasibutton' >spectrum</p>";
   print "<div id='pmt_spectrum_container' class='stylishBox padded'>";
-  print '<div id="spectrum_plot_container" style="width:600px;height:300px"></div>';
+  print "<table><tr><td>";
+  print '<div id="spectrum_plot_container" style="width:600px;height:300px;float:left;"></div>';
+  print "</td><td>";
+  print '<div id="choices"></div>';
+  print "</td></tr></table>";
   print "<input type='button' id='button_plot_spectrum' value='plot spectrum'>";
   print "<input type='button' id='button_clear_spectrum' value='clear spectrum'>";
   print "<label><input type='checkbox' id='checkbox_log_spectrum' >log y</label>";
-  print br br;
+  print br;
   print "record name: ";
   print "<input type='text' id='text_spectrum_name' value='signal'>";
   print "<input type='button' id='button_record_spectrum' value='record spectrum'>";
@@ -222,6 +226,8 @@ sub scan_sample {
     abort  => 0,
     cols => $scan_pattern->{cols},
     rows => $scan_pattern->{rows},
+    number_points => $scan_pattern->{number_points},
+    points_scanned => 0,
     current_col => 0,
     current_row => 0,
     ETA  => $ETA,
@@ -266,6 +272,7 @@ sub scan_sample {
         abort => 0,
         current_col => ($col+1),
         current_row => ($row+1),
+        points_scanned => $points_scanned,
         seconds_left => 0
       };
       $self->{status_shm}->writeShm($status);
@@ -280,6 +287,7 @@ sub scan_sample {
         %$status,
         current_col => ($col+1),
         current_row => ($row+1),
+        points_scanned => $points_scanned,
         seconds_left => $seconds_left
       };
       $self->{status_shm}->writeShm($status);