Class MathHelper

java.lang.Object
com.codename1.charts.util.MathHelper

public final class MathHelper extends Object
Utility class for math operations.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    A value that is used a null value.
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<Double>
    getLabels(double start, double end, int approxNumLabels)
    Computes a reasonable set of labels for a data interval and number of labels.
    static double[]
    minmax(List<Double> values)
    Calculate the minimum and maximum values out of a list of doubles.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NULL_VALUE

      public static final double NULL_VALUE
      A value that is used a null value.
      See Also:
  • Method Details

    • minmax

      public static double[] minmax(List<Double> values)

      Calculate the minimum and maximum values out of a list of doubles.

      Parameters
      • values: the input values
      Returns

      an array with the minimum and maximum values

    • getLabels

      public static List<Double> getLabels(double start, double end, int approxNumLabels)

      Computes a reasonable set of labels for a data interval and number of labels.

      Parameters
      • start: start value

      • end: final value

      • approxNumLabels: desired number of labels

      Returns

      collection containing the label values