hageldave / JPlotter

OpenGL based 2D Plotting Library for Java using AWT and LWJGL
https://github.com/hageldave/JPlotter/wiki
MIT License
45 stars 6 forks source link

Ready-to-use line chart class #24

Open hageldave opened 3 years ago

hageldave commented 3 years ago

When creating a line chart in JPlotter, the usual setup works something like this:

  1. create Lines objects and fill with line segment from data/sampled function
    1. for figuring out the segments coordinates it may be required to transform from some datatype to a numerical value. E.g. from LocalDateTime to double when dealing with time oriented data.
  2. put Lines in new LinesRenderer
  3. set or add LinesRenderer as content of new CoordSysRenderer
  4. set CoordSysRenderer as renderer of your JPlotterCanvas instance
  5. optional: add Points + PointsRenderer for points on the line from data
  6. optional: setup interaction capabilities, e.g. CoordSysScrollZoom, CoordSysAreaSelector, CoordSysPanning
  7. optional: setup custom interaction schemes through mouse/key listeners (e.g. highlighting line on mouse over)

This is a lot of setup for a standard chart.

To allow developers to quickly create a line chart 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, line selection, ...


There is also special care to be taken for the tick mark labeling of the axes depending on the unit that is represented (e.g. time). Unfortunately we cannot support every possible unit, so instead a generic approach has to be thought of where deevelopers need to provide some kind of converter from numerical value (double) to a string representation of the respective datatype/unit. This is related to issue #8. However, I think this tick mark labeling topic may be a whole issue on its own. So for the moment we will ignore it, and integrate it later into the line chart class.