Class ColorMapCSS.GradientND

Enclosing class:
ColorMapCSS

public static class ColorMapCSS.GradientND extends ColorMap.GradientND<String>
N dimensional color gradient with one color for each dimension.
  • Constructor Details

    • GradientND

      public GradientND(Color[] colors)
      Construct N dimensional color gradient to represent N dimensional data values. Each dimension i spans colors ranging from black to colors[i].

      The default range for mapping data values onto the color gradient is [0.0, 1.0] in all dimensions.

      Parameters:
      colors - the colors for each dimension
      See Also:
    • GradientND

      public GradientND(Color[] colors, Color bg)
      Construct N dimensional color gradient to represent N dimensional data with a background color other than black, or, to represent N+1 dimensional data values where one data value is dependent on the other N.

      The color gradient in each dimension i ranges from bg to colors[i].

      The default range for mapping data values onto the color gradient is [0.0, 1.0] in all dimensions.

      Parameters:
      colors - the colors for the N dimensions
      bg - the color representing the background (or an N+1, dependent trait)
      See Also:
    • GradientND

      public GradientND(Color[] colors, int idx)
      Construct N dimensional color gradient to represent N+1 dimensional data values where one data value is dependent on the other two. This applies, for example, to data based on the replicator equation and dynamics that unfold on the simplex SN.

      The index of the dependent trait is idx. It is at its maximum if all other traits are at their minimum. The color gradient in each dimension i ranges from colors[idx] to colors[i] for idx≠i.

      The default range for mapping data values onto the color gradient is [0.0, 1.0] in all dimensions.

      Parameters:
      colors - the colors for the N dimensions
      idx - the index of the dependent trait
      See Also:
  • Method Details

    • translate

      public String translate(double[] data)
      Translate the multi-trait double[] array data to a color. The type of object returned depends on the implementation.

      GradientND: color gradients are generated on the fly.

      Overrides:
      translate in class ColorMap.Gradient2D<String>
      Parameters:
      data - the double[] array to convert to a color
      Returns:
      CSS style color string of the corresponding gradient color
    • color2Color

      public String color2Color(Color color)
      Description copied from class: ColorMap
      Utility method to convert the color into a color object of type T.
      Specified by:
      color2Color in class ColorMap<String>
      Parameters:
      color - the color to convert
      Returns:
      the color represented as an object of type T
    • toGradient1D

      public ColorMap.Gradient1D<String> toGradient1D(int nIncr)
      Description copied from class: ColorMap.GradientND
      Convert the N-dimensional color map into a 1D gradient with a total of nIncr shades. This is useful for coloring schemes that are based on an aggregate characteristics, such as the distance, instead of the N-dimensional data.
      Specified by:
      toGradient1D in class ColorMap.GradientND<String>
      Parameters:
      nIncr - the total number of color increments
      Returns:
      the 1D color gradient