Record Class Trendline

java.lang.Object
java.lang.Record
io.keikai.axyra.sheets.content.Trendline

public record Trendline(String kind, double forward, double backward, int order, int period, boolean showEquation, boolean showRSquared) extends Record
A series trendline (ECMA-376 §21.2.2.210). kind is one of linear | exp | log | movingAvg | poly | power; order applies to poly, period to movingAvg.

Trendlines are honored by the in-memory model and the chart renderer (Sheet.renderChartToPng), and persist to the saved workbook (re-emitted as <c:trendline> per ECMA-376 §21.2.2.211).

  • Constructor Summary

    Constructors
    Constructor
    Description
    Trendline(String kind, double forward, double backward, int order, int period, boolean showEquation, boolean showRSquared)
    Creates an instance of a Trendline record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the value of the backward record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    double
    Returns the value of the forward record component.
    final int
    Returns a hash code value for this object.
    Returns the value of the kind record component.
    static Trendline
    A plain linear trendline.
    static Trendline
    movingAverage(int period)
    A moving-average trendline over period points.
    int
    Returns the value of the order record component.
    int
    Returns the value of the period record component.
    static Trendline
    polynomial(int order)
    A polynomial trendline of the given order.
    boolean
    Returns the value of the showEquation record component.
    boolean
    Returns the value of the showRSquared record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Trendline

      public Trendline(String kind, double forward, double backward, int order, int period, boolean showEquation, boolean showRSquared)
      Creates an instance of a Trendline record class.
      Parameters:
      kind - the value for the kind record component
      forward - the value for the forward record component
      backward - the value for the backward record component
      order - the value for the order record component
      period - the value for the period record component
      showEquation - the value for the showEquation record component
      showRSquared - the value for the showRSquared record component
  • Method Details

    • linear

      public static Trendline linear()
      A plain linear trendline.
    • movingAverage

      public static Trendline movingAverage(int period)
      A moving-average trendline over period points.
    • polynomial

      public static Trendline polynomial(int order)
      A polynomial trendline of the given order.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • kind

      public String kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • forward

      public double forward()
      Returns the value of the forward record component.
      Returns:
      the value of the forward record component
    • backward

      public double backward()
      Returns the value of the backward record component.
      Returns:
      the value of the backward record component
    • order

      public int order()
      Returns the value of the order record component.
      Returns:
      the value of the order record component
    • period

      public int period()
      Returns the value of the period record component.
      Returns:
      the value of the period record component
    • showEquation

      public boolean showEquation()
      Returns the value of the showEquation record component.
      Returns:
      the value of the showEquation record component
    • showRSquared

      public boolean showRSquared()
      Returns the value of the showRSquared record component.
      Returns:
      the value of the showRSquared record component