-
Notifications
You must be signed in to change notification settings - Fork 463
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
Feature: use kiwi.js for controlling min and max aspect #1046
Conversation
You might want to discuss this approach with Mateusz Paprocki, as he has years of experience working with kiwi for Bokeh, with a lot of positive and negative he can share... |
Thanks @jbednar, will do, I was actually looking at Bokeh, to see why it is not a dependency anymore, and I couldn't find it. |
Right. Talk to Mateusz about that. :-) |
In bokeh we dropped constraint system based layout, because of inadequacy of this approach both from functional and performance perspectives. If the decision was up to me at the time, we wouldn't go that direction at all, choosing a classical "box" layout (or QT-style layout) instead, which is what we use now. Constraint system based layout seems very appealing to people, almost irresistible as the initial approach, but usually it is eventually replaced by another approach, at least based on my observations. This approach could have been made at least somewhat viable if there was a solver 10x (or better 100x) faster than kiwi (was at the time, but looking at benchmarks in the new repository, that didn't change significantly). Even then, the complexity wouldn't be acceptable from long term maintenance point of view. Though that could have been a problem with our particular approach (a global solver, with thousands of constraints). I considered keeping kiwi to solve local optimisation problems within the layout, but that seemed more trouble than it was worth, considering issues with kiwi itself. |
b388eca
to
5a51aa7
Compare
Thanks for sharing your experience.
I think that is the approach we aim to use as well. I think for now it's easier to put the constraints in kiwi first, and let it solve it. It should be easy to replace by an analytical solution if needed/possible. |
Sylvain, you missed one of the emojis :) |
Was is ? |
Nice. I meant eyeballs, but I'm sure shipit will apply soon too :). |
Note that because of the refactor, we don't have |
80f265a
to
917400e
Compare
If I understand correctly, in the current state of the PR, there is a circle in the logic:
This means that |
I don't think that is the case, it depends on the getBBox(), which doesn't depends on the plot area size right, maybe you are confusing it with the Axis.width property (which does depend on the plot area size, and I was confused about that :)) |
390b444
to
1d71396
Compare
I'm rebasing your PR and testing it |
@maartenbreddels the problem I see with the approach is that the plot needs to be displayed already before being able to solve the constraints. This results in the plot being rendered a first time not properly, then we compute the constraints, then we display with the resulting solution. This can be seen in your screencast #1046 (comment), the plot gets displayed a first time without the axes, then the axes pops up (though it seems to happen quite fast on your laptop). I can reproduce this behavior more clearly locally: plot.mp4 |
@maartenbreddels as we discussed, I refactored the rendering logic a bit:
Plus a couple of fixes. I'm willing to add some Galata tests for this. |
This will improve bqplot performance overall right? |
I guess so. There was one extra relayout call that was not needed. |
30f5ac2
to
d88ba9b
Compare
Update galata references |
75f8b34
to
787b947
Compare
0ff37e9
to
132be0b
Compare
132be0b
to
f12c32b
Compare
d86b6f1
to
0f1fec7
Compare
0f1fec7
to
5304651
Compare
f141158
to
037cfae
Compare
Update galata references |
03a8643
to
b333b03
Compare
Describe your changes
For more complex layouts, we may want to use Cassoway solvers, where kiwi.js is an implementation of that.
Testing performed
Test are first written to confirm the current working solution, it is then rewritten using kiwi.\
Additional context
This is a proof of concept to show how it changes the code. Actually, we should keep the current solver, not rebuild it all the time from scratch for performance. Although maybe it is fast enough to let us do this.
Next step would be to add a layout feature based on kiwi, for instance, automatic padding or resizing based on color axes.