java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.marginallyclever.convenience.swing.graph.MultiLineGraph
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class MultiLineGraph extends JPanel
A simple line graph. Assumes at most one y value per x value. Interpolates between given values.
See Also:
  • Constructor Details

    • MultiLineGraph

      public MultiLineGraph()
  • Method Details

    • setModel

      public void setModel(GraphModel model)
    • getModel

      public GraphModel getModel()
    • setRange

      public void setRange(Rectangle2D.Double range)
      Set the visible range of the graph. Values outside this range will not be drawn.
      Parameters:
      range - the minimum values and size of the range.
    • getRange

      public Rectangle2D.Double getRange()
    • setRangeToModel

      public void setRangeToModel()
      Set the visible range of the graph to match the data in the model.
    • getDataBounds

      public double[] getDataBounds()
      Returns:
      minx,maxx,miny,maxy
    • getMajorLineColor

      public Color getMajorLineColor()
    • setMajorLineColor

      public void setMajorLineColor(Color majorLineColor)
    • getMinorLineColor

      public Color getMinorLineColor()
    • setMinorLineColor

      public void setMinorLineColor(Color minorLineColor)
    • getGridSpacingX

      public int getGridSpacingX()
    • setGridSpacingX

      public void setGridSpacingX(int gridSpacingX)
    • getGridSpacingY

      public int getGridSpacingY()
    • setGridSpacingY

      public void setGridSpacingY(int gridSpacingY)
    • assignQualitativeColors

      public void assignQualitativeColors()
      Set colors for each line in the graph based on the number of lines and the color wheel.