com.vaadin.flow.component.charts.model.style.

Class GradientColor

java.lang.Object
com.vaadin.flow.component.charts.model.style.GradientColor

All Implemented Interfaces:

Color, Serializable

public class GradientColor extends Object implements Color

Class providing gradient colors

See Also:

  • Method Details

    • getLinearGradient

      public GradientColor.LinearGradient getLinearGradient()

      Returns:

      The linear gradient

    • getRadialGradient

      public GradientColor.RadialGradient getRadialGradient()

      Returns:

      The radial gradient

    • getStops

      public List<GradientColor.Stop> getStops()

      Returns:

      The stops of the gradient color

    • addColorStop

      public void addColorStop(double d, SolidColor color)

      Adds a color stop to the gradient

      Parameters:

      d - The relative point of the color stop, between 0 and 1

      color - The color at the point defined by d

    • createLinear

      public static GradientColor createLinear(double startX, double startY, double endX, double endY)

      Creates a new linear gradient between two given points. Use addColorStop(double, SolidColor) to define the colors.

      Parameters:

      startX - The relative start point on the X-axis, 0..1

      startY - The relative start point on the Y-axis, 0..1

      endX - The relative end point on the X-axis, 0..1

      endY - The relative end point on the Y-axis, 0..1

      Returns:

      A new linear gradient color

    • createRadial

      public static GradientColor createRadial(double centerX, double centerY, double radius)

      Creates a radial gradient color at a specified point with the given radius. Use addColorStop(double, SolidColor) to define the colors.

      Parameters:

      centerX - The X coordinate of the center

      centerY - The Y coordinate of the center

      radius - The radius

      Returns:

      A new radial gradient