Package jcckit.plot

Class SimpleCurve

java.lang.Object
jcckit.plot.SimpleCurve
All Implemented Interfaces:
Curve

public class SimpleCurve extends Object implements Curve
A simple curve is the basic implementation of the Curve interface.
  • Field Details

  • Constructor Details

    • SimpleCurve

      public SimpleCurve(ConfigParameters config, int curveIndex, int numberOfCurves, ClippingShape clippingShape, Legend legend)
      Creates a new curve. The parameter config contains:
      Key & Default ValueTypeMandatory Description
      initialHintForNextPoint = null ConfigParametersno Definition of an initial Hint for the first curve point.
      lineAttributes = a ShapeAttributes instances with default values and line colors based on the formula Color.getHSBColor(curveIndex/6,1,0.8) ConfigParametersno Configuration parameters of an instances of GraphicAttributes for the Polygons connecting curve points.
      symbolFactory = null ConfigParametersno Configuration parameters defining an instances of SymbolFactory for the Symbols decorating curve points.
      softClipping = true booleanno If true no explicit clipping takes place but the symbol is not drawn if the corresponding curve point is outside the axis box.
      If false the symbol is drawn in any case but it may be clipped by the axis box. Soft-clipping should be set to false if the symbols are not located around the curve point (like for bars).
      withLine = true booleanno If true curve points are connected by a Polygon.
      Parameters:
      config - Configuration parameters described above.
      curveIndex - Index of this curve in the collection of curves defining a Plot.
      numberOfCurves - Number of curves in this collection.
      clippingShape - Clipping shape. Can be null.
      legend - Legend. Will be used to calculate the legend symbol.
      Throws:
      IllegalArgumentException - if symbolFactory == null and withLine == false.
  • Method Details

    • getView

      public GraphicalElement getView()
      Returns the graphical representation of a curve.
      Specified by:
      getView in interface Curve
      Returns:
      always the same instance.
    • getLegendSymbol

      public GraphicalElement getLegendSymbol()
      Returns the legend symbol.
      Specified by:
      getLegendSymbol in interface Curve
    • addPoint

      public Hint addPoint(GraphPoint point, Hint hintFromPreviousCurve)
      Appends a new point to the curve if inside the clipping shape.
      Specified by:
      addPoint in interface Curve
      Parameters:
      point - Position in device-independent coordinates.
      hintFromPreviousCurve - Hint which may be used to calculate the corresponding GraphicalElement.
      Returns:
      hint for next curve.
    • removeAllPoints

      public void removeAllPoints()
      Description copied from interface: Curve
      Removes all points from the curve.
      Specified by:
      removeAllPoints in interface Curve