Class LineSeries


public class LineSeries extends XYSeries

A line, spline, step or area series.

Splines are monotone cubic curves: they pass through every point and never overshoot between two of them, so a smoothed line cannot invent a peak the data does not have. Dense data is reduced to the minimum and maximum of each pixel column before drawing, which keeps every spike while painting a constant number of segments.

Lines with markers A spline A step line Stacked areas

  • Field Details

    • STRAIGHT

      public static final int STRAIGHT
      Straight segments between points.
      See Also:
    • SPLINE

      public static final int SPLINE
      A monotone cubic curve through the points.
      See Also:
    • STEP

      public static final int STEP
      A horizontal run to each point's x, then a vertical step.
      See Also:
  • Constructor Details

    • LineSeries

      public LineSeries(String name)

      Creates an empty line series.

      Parameters
      • name: the legend name
  • Method Details

    • setMode

      public LineSeries setMode(int mode)
      STRAIGHT, SPLINE or STEP.
    • getMode

      public int getMode()
      The drawing mode.
    • setFilled

      public LineSeries setFilled(boolean fill)
      Fills the area under the line, turning it into an area series; stacked areas need a shared setStackGroup.
    • isFilled

      public boolean isFilled()
      True for an area series.
    • setFillAlpha

      public LineSeries setFillAlpha(int alpha)
      Opacity of the area fill, 0 to 255.
    • setLineWidth

      public LineSeries setLineWidth(float mm)
      Line thickness in millimetres.
    • setMarkers

      public LineSeries setMarkers(boolean markers)
      Draws a dot at every point (skipped automatically when points are too dense to tell apart).
    • setDashed

      public LineSeries setDashed(boolean dashed)
      Draws a dashed line, for targets and forecasts.
    • consumesStackBase

      protected boolean consumesStackBase()
      Description copied from class: XYSeries

      True for a series drawn on its stack base (an area or a bar), which a stack group lifts and whose layer shrinks with the fraction it is shown while it fades; false for marks that keep their own values (scatter, error bars, candles, boxes).

      Returns

      false by default

      Overrides:
      consumesStackBase in class XYSeries
    • paint

      public void paint(ChartContext ctx)
      Description copied from class: Series

      Paints the series.

      Parameters
      • ctx: the current frame: graphics, plot area, axes and animation progress
      Specified by:
      paint in class Series