Closed hageldave closed 1 year ago
Should the interaction possibilities (e.g. "select area and zoom into it") be predefined by the ScatterPlot class or should the user also be able to define his own interactions? For example the CoordSysViewSelector class is abstract and therefore an object can't be returned to the user, before its methods are implemented. If i'm not missing anything, this implicates that the interaction possibilities have to be predefined by the ScatterPlot class? This question might also apply to other interaction schemes, like the mouse/key listeners.
I'd say the developers should be able to define their own interactions in addition to "standard" interactions which are panning, scroll zooming, and area zooming. The way the developers can add their custom interaction schemes needs a bit more thought I guess. I'll think of something
As already discussed internally
The scatter plot class should provide a listener interface to be notified when a point of the scatter plot is hovered over by the mouse cursor. Something like mouseOverPoint(Point mouseLocation, Point2D pointLocation, double[] data, int dataIndex)
. The triggering has has to be realized through picking, meaning that on every mouseMoved event the current picking color under the cursor has to be fetched to check whether mouse over is occurring.
A similar functionality for clicking on a scatter plot point should also be supported, e.g.
pointClicked(int mouseButton, Point mouseLocation, Point2D pointLocation, double[] data, int dataIndex)
.
Not discussed internally
A rectangular selection of scatter plot points should also be supported in some way. I'm also thinking of a listener interface, e.g.
pointsSelected(Rectangle2D bounds, List<double[]> data, List<Integer> dataIndices)
that is notified when a rectangular selection was made (not on area zooming though).
This should at least allow for a convenient implementation of most conventional scatter plot interactions.
(Please excuse my ignorance of the current point set/dataset structure of the scatterplot class in my suggested method signatures)
TODO for me: check class for open issues. If ok, it can be merged.
A lasso selection was introduced in branch rope-selection https://github.com/hageldave/JPlotter/tree/rope-selection scatter plot was merged into the lasso branch, so these two features are coupled
@lvcarx you mentioned that the branch https://github.com/hageldave/JPlotter/tree/temp-scatterplot-and-barchart had fixes which should be adopted. I don't want this temporary branch to be merged with anything (rather delete it at some point). So could you please copy the fixes? I think they are in these two commits:
now in master as of 5758ffc7c4f0468342d3746d2a818c39df823d95
When creating a scatter plot in JPlotter, the usual setup works something like this:
Points
objects and fill with coordinates from dataPoints
in newPointsRenderer
PointsRenderer
as content of newCoordSysRenderer
CoordSysRenderer
as renderer of yourJPlotterCanvas
instanceCoordSysScrollZoom
,CoordSysAreaSelector
,CoordSysPanning
This is a lot of setup for a standard chart.
To allow developers to quickly create a scatterplot of their data, an extensible convenience class for a scatter plot needs to be developed. The class should also allow for an easy setup of interaction schemes, e.g. mouseover, point selection, area selection.