Class GradientColorCoding

java.lang.Object
no.uib.jsparklines.renderers.util.GradientColorCoding

public class GradientColorCoding
extends Object
Contains methods related to calculating color gradients.
Author:
Harald Barsnes, Lennart Martens
  • Constructor Details

  • Method Details

    • findGradientColor

      public static Color findGradientColor​(Double aValue, Double aMinValue, Double aMaxValue, GradientColorCoding.ColorGradient colorGradient, boolean positiveValuesOnly)
      Returns the gradient color using the currently selected color gradient. The first color of the gradient is used for values close to the min value, while the third color of the gradient is used for values close to the max value. If only positive values are expected (positiveValuesOnly is true) the middle gradient color is used for the halfway point between the min and max values. If both positive and negative values are expected (positiveValuesOnmiddlely is false) the middle gradient color is used for values around zero.
      Parameters:
      aValue - the value to find the gradient color for
      aMinValue - the min value
      aMaxValue - the max value
      colorGradient - the color gradient to use
      positiveValuesOnly - if true only positive values are expected and the middle gradient color is used for the halfway point between the min and max values, if false the middle gradient color is used for values around zero
      Returns:
      the gradient color