Skip to content

Commit 26c7c09

Browse files
committed
add vizualization of plot
1 parent d6d9e18 commit 26c7c09

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

notebookjs/src/public/javascripts/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ let vars_in_scope = {
1414

1515
function exec_cell(id, count) {
1616

17+
window.current_cell = id;
1718
let global_scope = ("global", eval)(vars_in_scope[id].getValue())
1819

1920
if(Array.isArray(global_scope)){
2021
global_scope = print_val(global_scope)
2122
}
22-
$(`#out_${id}`).html(global_scope || "");
23+
$(`#out_${id}`).html(global_scope);
2324

2425
count = parseInt(count) + 1
2526
let div_count = `div-${count}`
2627

28+
window.current_cell = div_count
2729
if (!(div_count in vars_in_scope)) {
2830
$("#container").append(
2931
`<div id=${div_count} class=""></div><br />

notebookjs/src/public/javascripts/utils.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,15 @@ function print_val(val){
7676
return data_string;
7777

7878
}
79+
}
80+
81+
function viz(name,callback){
82+
83+
let id = `#out_${window.current_cell}`
84+
$(`${id}`).append(`<div id=${name}></div>`)
85+
86+
let cb = callback(name);
87+
// $("#ploty").remove(`${name}`)
88+
89+
return cb
7990
}

notebookjs/src/views/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747
</div>
4848
<div class="col-md-1"></div>
4949
<div id="out_div-1" class="col-md-10 out-divs">
50-
5150
</div>
52-
</div>
5351

52+
</div>
53+
<div id="ploty"></div>
5454
</div>
5555

5656

0 commit comments

Comments
 (0)