From 8babcfd4c145ca0e2cf5b81e85eec57b2c8dcb98 Mon Sep 17 00:00:00 2001 From: Michael Wiebusch Date: Fri, 30 Jan 2015 11:07:59 +0100 Subject: [PATCH] small changes --- user_interface/coral_scanner.js | 57 ++++++++++++++++++++++++++------- user_interface/coral_scanner.pm | 12 +++++-- 2 files changed, 55 insertions(+), 14 deletions(-) diff --git a/user_interface/coral_scanner.js b/user_interface/coral_scanner.js index 2e07d28..4f8e810 100644 --- a/user_interface/coral_scanner.js +++ b/user_interface/coral_scanner.js @@ -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("
" + + ""); + }); + + 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 }); } }); diff --git a/user_interface/coral_scanner.pm b/user_interface/coral_scanner.pm index 6299543..d66e523 100644 --- a/user_interface/coral_scanner.pm +++ b/user_interface/coral_scanner.pm @@ -168,11 +168,15 @@ sub main_html { print "

spectrum

"; print "
"; - print '
'; + print "
"; + print '
'; + print "
"; + print '
'; + print "
"; print ""; print ""; print ""; - print br br; + print br; print "record name: "; print ""; print ""; @@ -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); -- 2.43.0