-
Notifications
You must be signed in to change notification settings - Fork 323
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
Lazy scatterplot for Vector & Table #3655
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the JS part only!
app/gui/view/graph-editor/src/builtin/visualization/java_script/scatterPlot.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks a reasonable approach - one concern is how to allow loading of more points after the first 32.
distribution/lib/Standard/Visualization/0.0.0-dev/src/Scatter_Plot.enso
Outdated
Show resolved
Hide resolved
app/gui/view/graph-editor/src/builtin/visualization/java_script/scatterPlot.js
Outdated
Show resolved
Hide resolved
@@ -58,6 +61,14 @@ class ScatterPlot extends Visualization { | |||
this.points = { labels: VISIBLE_POINTS } | |||
} | |||
|
|||
updatePreprocessor() { | |||
let fn = 'x -> process_to_json_text x limit=' + this.limit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CCing @4e6: Calling this.setPreprocessor
repeatedly with different code snippet seems to work, but ideally we shall have a single snippet and just invoke it with different limit
and bounds
argument. I hope it will be possible to do something like that with hidden modules.
#3661 introduces this.setPreprocessor(module, method)
- it shall also allow providing arguments somehow.
distribution/lib/Standard/Visualization/0.0.0-dev/src/Scatter_Plot.enso
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One slight change - just want to think if an easier way to do the extremes.
distribution/lib/Standard/Visualization/0.0.0-dev/src/Scatter_Plot.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Visualization/0.0.0-dev/src/Scatter_Plot.enso
Outdated
Show resolved
Hide resolved
Thanks James for the 6473ad1 simplification of the computation of the sample. |
Pull Request Description
First of all this PR demonstrates how to implement lazy visualization:
bounds
andlimit
) toprocess_to_json_text
function.process_to_json_text
can be tested by standard Enso test harness which this PR also doessetPreprocessor
expression using the optional parametersThe idea of scatter plot lazy visualization is to limit the amount of points the IDE requests. Initially the limit is set to
limit=1024
. TheScatter_Plot.enso
then processes the data and selects/generates thelimit
subset. Right now it includesmin
,max
in bothx
,y
axis plus randomly chosen points up to thelimit
.The D3 visualization widget is capable of zooming in. When that happens the JavaScript widget composes new expression with
bounds
set to the newly visible area. By callingsetPreprocessor
the engine recomputes the visualization data, filters out any data outside of thebounds
and selects anotherlimit
points from the new data. The IDE visualization then updates itself to display these more detailed data. Users can zoom-in to see the smallest detail where the number of points gets bellowlimit
or they can select Fit all to see all the data without anybounds
.Important Notes
Randomly selecting
limit
samples from the dataset may be misleading. Probably implementing k-means clustering (wherek=limit
) would generate more representative approximation.Checklist
Please include the following checklist in your PR:
Table
andColumn
Scala,
Java,
and
Rust
style guides.
./run ide build
and./run ide watch
.