-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: A Patchable backend #89
Conversation
Damn. |
Head explodes. |
This is really exciting! I can see how the client-side pan/zoom implemented now may really difficult to reconcile. It gets pretty hairy since it applies a transformation then has to un-scale a bunch of geometry that should be scale invariant. I think it could be solved if, like you suggest, it called back to Julia on pan/zoom and gave it the option of re-rendering. So much good stuff we could do with that: dynamic bin sizes, recomputing label positions, contour plots that increase in resolution, plotting functions at increasing resolution, etc. |
OK I think this is ready to get merged, save naming improvements (Patchable...?) - suggestions are welcomed here. One question remains: What is the right way to allow the user to configure Compose to use Patchable? Time for a Patchable outperformed (in terms of time taken) the SVG backend consistently for all plots I tried off of gadflyjl.org - except for the One more micro-benchmark: with 50 particles in the particles-in-a-box example described here - JuliaGizmos/Interact.jl#36 (comment) I got the following on Julia does seem to go easy on the CPU with Patchable. The GC pauses seem less pronounced, even non-existent. cc @ViralBShah |
I think it would be nice to make Patchwork a default dependency of Compose, and given that it is pure Julia, it won't complicate things. @shashi just explained to me that there may be cases like pan-and-zoom where one may not want to use Patchwork as a default backend. I think that the behaviour of Compose should not change in case Patchwork is installed, as it currently seems to be the case. Perhaps we can enable its use through the API. |
+1 to the idea of calling back Julia on events in the browser that would let us do a lot more interesting things. For example, doing interactive histograms over large datasets would become simple to implement. I think some of these recent capabilities are really putting us ahead of the pack. Really excited! |
Cc: @alanedelman |
Compose now imports Patchwork and Reactive if they are installed and defines a |
👍 |
This back-end lets us draw Compose and Gadfly graphics using virtual-dom for rendering. There is a mechanism through which re-rendering happens via a diff-patch mechanism using Patchwork.jl: a set of patches is computed against the previously rendered SVG document and then applied.
This optimizes for network usage. And also allows for full-blown FRP-based GUI programming a la Elm and mercury using Julia+JavaScript.
Comments are welcome! I added
draw_recursive
to reduce the bookkeeping I had to do in the back-end if I were to usedrawpart
which seemed better for rendering by writing to a buffer, as opposed to rendering by constructing a data structure.TODO
viewBox
. Zooming can also be implemented with viewBox, but will look weird. One good approach is to have Julia be involved in the zoom and pan process, I would love to zoom into a histogram and have the granularity increase as I do. This sort of a thing requires Julia intervention anyway. An extension of the idea is to have this behave like Google maps, i.e. initial zoom using viewBox, and then fetch patches from Julia to show more detail. I feel this item requires a more general widget creation mechanism to come from Patchwork or another package, so this probably should not block this PR.text
elements should not be escaped while renderingPatchwork issues