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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GradientColorCoding.ColorGradient
List of supported color gradient types. -
Constructor Summary
Constructors Constructor Description GradientColorCoding()
-
Method Summary
Modifier and Type Method Description static Color
findGradientColor(Double aValue, Double aMinValue, Double aMaxValue, GradientColorCoding.ColorGradient colorGradient, boolean positiveValuesOnly)
Returns the gradient color using the currently selected color gradient.
-
Constructor Details
-
GradientColorCoding
public GradientColorCoding()
-
-
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 foraMinValue
- the min valueaMaxValue
- the max valuecolorGradient
- the color gradient to usepositiveValuesOnly
- 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
-