Skip to content

Commit

Permalink
plotly continuous loading
Browse files Browse the repository at this point in the history
  • Loading branch information
shrutivarade committed May 6, 2024
1 parent 70b688e commit 81292eb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions examples/plotly.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://boostlet.org/dist/boostlet.min.js";

// script.src = "https://boostlet.org/dist/boostlet.min.js";
// script.src = "http://localhost:8000/dist/boostlet.min.js";
script.src = "https://shrutivarade.github.io/boostlet/dist/boostlet.min.js";
script.onload = run;
document.head.appendChild(script);
eval(script);
Expand All @@ -11,8 +12,6 @@ function run() {
// detect visualization framework
Boostlet.init();

all_pixels = Boostlet.get_image().data;

// load Plotly.js library and start plotting in the onload callback
Boostlet.load_script('https://cdn.plot.ly/plotly-2.25.2.min.js', plot);

Expand All @@ -33,10 +32,19 @@ function plot() {
}
window.document.body.appendChild(container);

updatePlot();

}

function updatePlot(){

all_pixels = Boostlet.get_image().data;

// plot the data
Plotly.newPlot('plotlyDiv', [{
x: all_pixels,
type: 'histogram'
}]);

updatePlot();
}

0 comments on commit 81292eb

Please sign in to comment.