Skip to content
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

Ready-to-use scatter plot class #22

Closed
hageldave opened this issue Mar 24, 2021 · 7 comments
Closed

Ready-to-use scatter plot class #22

hageldave opened this issue Mar 24, 2021 · 7 comments
Assignees

Comments

@hageldave
Copy link
Owner

When creating a scatter plot in JPlotter, the usual setup works something like this:

  1. create Points objects and fill with coordinates from data
  2. put Points in new PointsRenderer
  3. set or add PointsRenderer as content of new CoordSysRenderer
  4. set CoordSysRenderer as renderer of your JPlotterCanvas instance
  5. optional: setup interaction capabilities, e.g. CoordSysScrollZoom, CoordSysAreaSelector, CoordSysPanning
  6. optional: setup custom interaction schemes through mouse/key listeners (e.g. highlighting points on mouse over)

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.

@lvcarx lvcarx self-assigned this Apr 7, 2021
@lvcarx
Copy link
Collaborator

lvcarx commented Apr 11, 2021

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.

@lvcarx lvcarx added the question Further information is requested label Apr 11, 2021
@hageldave
Copy link
Owner Author

hageldave commented Apr 12, 2021

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

@lvcarx lvcarx removed the question Further information is requested label Apr 12, 2021
@hageldave
Copy link
Owner Author

hageldave commented Apr 16, 2021

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)

@hageldave
Copy link
Owner Author

TODO for me: check class for open issues. If ok, it can be merged.

@hageldave
Copy link
Owner Author

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

@hageldave
Copy link
Owner Author

@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:

  • 19b1bcc cue set sanitization
  • bc2306b not pointIdx=-1 for legend element color

@hageldave
Copy link
Owner Author

now in master as of 5758ffc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants