-
Notifications
You must be signed in to change notification settings - Fork 18
Formula grid #542
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
Formula grid #542
Conversation
|
OK, I added a prototype of mouseover. You can see it in action in this monochrome version of the gcd(x,y) plot (not saying it's the best version of such a plot, by any means): However, I definitely don't think it is done. Right now it just overlays the mouseover text at the top right of the canvas, in the default font and color. There's no effort to set it off in a box and no styling. I could definitely use feedback/ideas on what the mouseover text should look like and where it should appear. Should it follow some offset from the mouse like FactorHistogram? Should it always be in the top right corner? Or should it actually be just above the canvas somewhere so it shows up in the specimen bar? Or some other location option? (Or heavens forfend, should its location be configurable in some way? We should not indulge in configurability always for configurability's sake...) Personally, I would be happy with it styled in some way (maybe an outlined box with an opaque or semitransparent white or pastel-tinted background, maybe with the same drop shadows as our help boxes) and always appearing in the same place (like the top right where it is now, or any fixed location folks think would be better...). |
|
So I think this PR is now at the stage that it would be best for me to get some feedback before proceeding further, even though it is still a draft. |
|
In particular @katestange if you could try translating some of your specimens from #526 into this FormulaGrid and see how that goes, that would be really great. |
|
This particular error may be difficult to isolate, since it presumably has to do with the pile of sequences I have in my sequence chooser, but when I open the sequence chooser, I get |
|
I suspect it's because it has to compute the chroma scale afresh for each dot. |
Maybe one possibility is to have more inbuilt chroma scales for people to choose from that are pre-computed? |
This is borne out by a better formula: http://localhost:5173/?name=Formula%3A+n&viz=FormulaGrid&aspect=0.999&backgroundColor=040404FF&speed=100&fillFormula=%7Bcircle%3A+chroma.mix%28%27%23ffff6a%27%2C+%27%23000000%27%2C+1-gcd%28x%2Cy%29%2Fmax%28x%2Cy%29%2C+%27hsl%27%29%7D&inset=1&seq=Formula That's a variation on my favourite "gcd" self-similarity. |
Because |
|
OK, should be fixed if you pull. |
I observe the same thing, and if I replace the scale with "rainbow" it's super snappy. So I agree, recomputing the scale is expensive. But formula |
Ah yes, you and I got to the same place; your comment just hadn't refreshed into my view of this page when I was working on the "laggy" comment. So unless you think otherwise, there doesn't seem to be any action item here. |
Yeah, I think I would need more than that to debug. I'm not seeing this phenomenon. |
I think this is #539 biting you. Let me know if you want me to fold a fix for that into this PR. |
|
Oh, I added a to-do item at the top about featured specimens - @katestange feel free to push a commit with some you like whenever the feeling moves you. |
|
Would it be ok if I push a few new functions for colours? There's things I'm trying to do simply/frequently that it would be great to have shortcuts for. Like "rainbow()". |
|
It would be great to have a variable for the coordinates of the center of the canvas |
|
For example, here's Gaussian split prime soup: (which could use centre coordinates): http://localhost:5173/?name=Gaussian+Split+Prime+Soup&viz=FormulaGrid&dimensions=100&aspect=0.999&backgroundColor=822F4FFF&speed=100&fillFormula=%7B+circle%3A+chroma%28%27%235db374%27%29.alpha%280.8*isPrime%28%28x-100%29%5E2%2B%28y-50%29%5E2%29%29+%7D&inset=1&seq=Formula |
|
Because there's a little question mark next to the little drag handle to grow the formula box, it's hard to get with the mouse. Maybe the formula box entire lower bar should drag? |
|
Indeed, in my very first e2e run, one of the formulagrid filled more pixels than expected and one filled less. Everything else was fine. Will investigate. |
|
@katestange, you have the alpha formula in the Modular Multiplication Table featured specimen to be |
|
OK, I believe I tracked down an async race condition between onBeforeMount and onMounted in the Scope.vue view, and fixed it. The tests seem much more solid to me now. Give them a whirl on your end. If all seems well, then we just need to discuss the popups with the description of the formula parameters, and then I need to tweak the documentation just a little more, and update the CI snapshots, and we shoulld be ready for final review. |
|
OK, I had found another bug in that when you changed the dimensions, the canvas wouldn't change shape even if the change resulted in a different requestedAspectRatio. That's fixed now, so we remain in exactly the state of my immediately preceding comment. |
|
This is the one Aaron and Glen collaborated one: http://localhost:5173/?name=OEIS+A010051&viz=FormulaGrid&dimensions=70+70&aspect=1&fillOrder=1&pathFormula=spiral%28k%29&backgroundColor=000000FF&fillFormula=%7Brectangle%3A+chroma.lch%2832+%2B+7*sin%285%2F9*pi*sqrt%28k%29%29%2C+31%2C+100*sqrt%28k%29%29%2C+circle%3A+chroma.lch%2875%2C+81%2C+72%29.alpha%28a%29%7D&inset=0.8&seq=OEIS+A010051 I think it's fantastic, we should add it as a gallery specimen! |
Definitely! |
OK, I will definitely use it for the snapshot. As far as featured specimens go, I think we shouldn't have both the Ulam Divisors and this one -- I feel like they are cognitively too close. I think we may at some point want to have a "library" of specimens that are not all "Featured" and then I'd be happy to include this (as well as maybe a very plain, very zoomed-out Ulam spiral). For now I will just put it in the interesting specimens discussion. |
|
OK, please check out the new placeholders for dimensions and aspect. It was a bit tricky because the placeholder needs to stay even when you have entered the number of rows but not the number of columns, so that you can see how many columns the visualizer ended up choosing. But I think I have it working OK now -- happy for any feedback. As far as I know, once we are settled on this I can update the CI snapshots and mark this as ready for review. Of course if you see anything else that needs improving, just let me know. |
Wow, this is great! It's really nice and intuitive. |
|
OK, I am not at the moment aware of anything that needs to be done with respect to this PR and all tests are passing, so I have marked it ready for review. Of course, if anything comes up in the final review, I am happy to make further changes/fixes. |
|
Small detail: "visualizer" isn't capitalized in the documentation page title (in contrast to other Visualizers). That's the only nitpick I have left! |
|
OK, typo should be fixed. |
* wip: start FormulaGrid visualizer
* feat: Prototype FormulaGrid visualizer
* feat: prototype mouseover feature of FormulaGrid
* fix: correct aspect validation
* fix: interpret any number as a color in some way or other
* fix: Typescript doesn't know abs(number) is number??
* fix: Miscellaneous UI improvements
* Put the help-info icon for a field near its top rather than its
bottom so that it will not move as you resize a formula input area
* Pop the resulting help info up above all other elements so the whole
thing is readable
* Validate and restore color codes correctly
* At load time and whenever there is input, auto-grow formula text areas
if necessary to show the entire formula
* feat: mouseover text opaque, shadowed, and moves left to right
* feat: inset is formula
* fix: edge browser z-indexing
* fix: updates per review
* doc: add diagram for hexagon and plug for using it with Triangle fill order
* featured specs
* doc: triangle diagram and misc fixes
* feat: mouseover popup travels with mouse pointer, avoiding in corner
* doc,test: document and test math.triangular and inverse
* fix,test: remove async race in Scope.vue mounting, update tests
* fix: Recompute size on visualizer reset(); e.g, aspect ratio might change
* ui: placeholder for aspect
* ui: ditto for dimensions
* feat: allow placeholder to remain on input, use for dimensions/aspect
* chore: briefer formulas in featured gallery and generate example images
* doc: final polish on new doc, some formula features for it
* chore: continuous integration snapshots
* doc: fix capitalization typo
---------
Co-authored-by: Kate Stange <kstange@math.colorado.edu>
* wip: start FormulaGrid visualizer
* feat: Prototype FormulaGrid visualizer
* feat: prototype mouseover feature of FormulaGrid
* fix: correct aspect validation
* fix: interpret any number as a color in some way or other
* fix: Typescript doesn't know abs(number) is number??
* fix: Miscellaneous UI improvements
* Put the help-info icon for a field near its top rather than its
bottom so that it will not move as you resize a formula input area
* Pop the resulting help info up above all other elements so the whole
thing is readable
* Validate and restore color codes correctly
* At load time and whenever there is input, auto-grow formula text areas
if necessary to show the entire formula
* feat: mouseover text opaque, shadowed, and moves left to right
* feat: inset is formula
* fix: edge browser z-indexing
* fix: updates per review
* doc: add diagram for hexagon and plug for using it with Triangle fill order
* featured specs
* doc: triangle diagram and misc fixes
* feat: mouseover popup travels with mouse pointer, avoiding in corner
* doc,test: document and test math.triangular and inverse
* fix,test: remove async race in Scope.vue mounting, update tests
* fix: Recompute size on visualizer reset(); e.g, aspect ratio might change
* ui: placeholder for aspect
* ui: ditto for dimensions
* feat: allow placeholder to remain on input, use for dimensions/aspect
* chore: briefer formulas in featured gallery and generate example images
* doc: final polish on new doc, some formula features for it
* chore: continuous integration snapshots
* doc: fix capitalization typo
---------
Co-authored-by: Kate Stange <kstange@math.colorado.edu>



By submitting this PR, I am indicating to the Numberscope maintainers that I have read and understood the contributing guidelines and that this PR follows those guidelines to the best of my knowledge. I have also read the pull request checklist and followed the instructions therein.
Introduces the FormulaGrid Visualizer, a formula-based common generalization of Grid and SelfSimilarity.
The following tasks have been completed:
(including improving help popups in parameter tab)[decided to leave that for post alpha when we have more features for help facilities, like markdown or context-help "drawer")Here's a classic view of the arithmetic triangle:
http://localhost:5173/?name=OEIS+A007318&viz=FormulaGrid&aspect=r&fillOrder=2&pathFormula=%5Bceil%28c%2F2%29+-+invTriangular%28k-1%29+%2B+2*%28k+-+triangular%28invTriangular%28k-1%29%29+-+1%29%2CinvTriangular%28k-1%29+%2B+1%5D&fillFormula=%7Bhexagon%3A+rainbow%2872a%29%7D&seq=OEIS+A007318
Resolves #527