@@ -321,7 +321,13 @@ function timeseries_card(app, key, session)
321
321
322
322
# extract the data
323
323
data = Observable {Vector{Vector{Float32}}} (Vector{Float32}[])
324
+ datahash = Ref {UInt64} ()
324
325
onany (ts, valid_idxs, tsplot. rel, app. sol; update= true ) do _ts, _valid_idxs, _rel, _sol
326
+ # only replot if the data has actually changed
327
+ newhash = hash ((_ts, _valid_idxs, _rel, _sol))
328
+ newhash == datahash[] && return
329
+ datahash[] = newhash
330
+
325
331
@debug " TS: t, valid_idx, rel, sol => update data"
326
332
_dat = _sol (_ts, idxs= _valid_idxs)
327
333
if _rel
@@ -342,7 +348,7 @@ function timeseries_card(app, key, session)
342
348
# store the idxs for which the autolmits where last set
343
349
last_autolimits = Ref ((eltype (valid_idxs)(), tsplot. rel[]))
344
350
# plot the thing
345
- onany (data, replot) do _dat, _
351
+ onany (data, replot; update = true ) do _dat, _
346
352
@async begin
347
353
try
348
354
empty! (ax)
@@ -404,16 +410,7 @@ function timeseries_card(app, key, session)
404
410
id= key
405
411
)
406
412
407
- # trigger plot on document ready
408
- trigger_plot = js """
409
- window .addEventListener (' load' , function () {
410
- console .log (" Document ready, trigger plot" );
411
- $ (replot).notify ();
412
- });
413
- """
414
- Bonito. evaljs (session, trigger_plot)
415
-
416
- return card
413
+ return card, obsf
417
414
end
418
415
function closebutton (app, key)
419
416
button = Bonito. Button (" ×" , class= " close-button" )
0 commit comments