Move sample processing in JS (mean value).  Retrieve raw data from AJAX.