Open tkf opened 4 years ago
Hm, maybe you have to call vegaEmbed
from julia, a la run(win, "vegaEmbed(blabla)")
? I would assume that at that stage everything is loaded.
But maybe there is also a different/earlier event than did-finish-load
that we could hook into, I'm not sure.
Oh, and bt.w VegaStreams.jl looks awesome!! I've been think about something like that for a while, but always thought I would first try to finish https://github.com/davidanthoff/ObservableInterfaces.jl, which would automatically give us an "observable tables" interface (i.e. an observable of named tuples). But just starting with this the way you did is certainly a better idea, because who knows when I'll find time for the observable story.
maybe you have to call
vegaEmbed
from julia, a larun(win, "vegaEmbed(blabla)")
? I would assume that at that stage everything is loaded.
That makes sense. I'll try that.
Oh, and bt.w VegaStreams.jl looks awesome!!
That's all thanks to ElectronDisplay (and Vega-Lite)! I was very surprised that it can be done with such a small amount of code.
but always thought I would first try to finish https://github.com/davidanthoff/ObservableInterfaces.jl, which would automatically give us an "observable tables" interface (i.e. an observable of named tuples)
BTW, I think it's already (somewhat) usable with iterator-based interface.
vls = vegastream(@vlplot(:line, x=:x, y=:y))
enumerate(randn(100)) |>
@map({x=_[1], y=_[2]}) |>
@filter(_.y > 0) |>
itr -> foldl(push!, itr; init=vls)
For fun, an equivalent implementation in Transducers.jl is:
vls = vegastream(@vlplot(:line, x=:x, y=:y))
xf = Map(NamedTuple{(:x, :y)}) |> Filter(row -> row.y > 0)
foldl(push!, xf, enumerate(randn(100)); init=vls)
Man, I really need to understand transducers. But somehow my brain is just not wired the right way for that...
The nice thing about the ObservableInterface would be that it supports a proper push interface, rather than a pull story.
In https://github.com/tkf/VegaStreams.jl ("Real-time" plotting with VegaLite.jl and ElectronDisplay.jl), I wanted to call
sendMessageToJulia
like this:However, it looks like
sendMessageToJulia
is not available here, presumably because it is defined ondid-finish-load
event which is too late? Can it be defined earlier? Or is there a better JavaScript pattern to do this?