From 81292eb205d1fd03a959379e4391805ca23fda25 Mon Sep 17 00:00:00 2001 From: Shruti Varade Date: Mon, 6 May 2024 16:43:12 -0400 Subject: [PATCH] plotly continuous loading --- examples/plotly.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/examples/plotly.js b/examples/plotly.js index 9dc24a5f..d29168dc 100644 --- a/examples/plotly.js +++ b/examples/plotly.js @@ -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); @@ -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); @@ -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(); }