Skip to content

Instantly share code, notes, and snippets.

@zalazhar
zalazhar / View.html
Last active June 4, 2017 17:43
View
'''html
<body>
<div class="d-flex flex-row" id= "first_row">
<div class="p-2" ><select id="selectNumber">
<option>Choose Age</option>
</select>
</div>
<div class="p-2" id ="plot_le"> Wait plotting histogram...</div>
<div class = "p-2" id ="plot_le_time"> </div>
function form (json){
return Object.keys(json).map(key=>encodeURIComponent(key)+'='+encodeURIComponent(json[key])).join('&');
};
function createRobject(Rlib, Rfunc, Rparams) {
return fetch(Rlib + Rfunc, {
method: 'post',
headers: {
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/x-www-form-urlencoded'
function workflow (age){
co(function *(){
// initialize views
document.getElementById('plot_le').innerHTML = "Please wait, loading graphs ..."
document.getElementById('plot_le_time').innerHTML = "Please wait, loading graphs ..."
// generate the R objects:
var stochasticSet = yield createRobject(Riskmodel,"loadSimData",{}) ;
var expectedLife = yield createRobject(Riskmodel,"eex",