Class LinearGradient
Defines a smooth transition between a set of colors (so-called “stops”) on a line.
Inherited Members
Namespace: Syncfusion.JavaScript.DataVisualization.Models.Diagram
Assembly: Syncfusion.EJ.dll
Syntax
public class LinearGradient : Gradient
Constructors
LinearGradient()
Initializes a new instance of the LinearGradient class.
Declaration
public LinearGradient()
LinearGradient(LinearGradient)
Initializes a new instance of the LinearGradient class.
Declaration
public LinearGradient(LinearGradient src)
Parameters
Type | Name | Description |
---|---|---|
LinearGradient | src | Object to copy. |
Properties
Type
Gets or sets the type of the gradient to be applied.
Declaration
[JsonProperty("type")]
public override string Type { get; }
Property Value
Type | Description |
---|---|
System.String | "linear" |
Overrides
Examples
// Apply the fill color for the node
LinearGradient Gradient = new LinearGradient() { Type ="linear" };
Gradient.Stops.Add(new Stop() { Color = "red" });
Gradient.Stops.Add(new Stop() { Color = "pink" });
Node Node = new Node() { Gradient = Gradient };
X1
Gets or sets the left most position(relative to node) of the rectangular region that needs to be painted
Declaration
[JsonProperty("x1")]
public double X1 { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 0 |
Examples
Node Node = new Node();
Node.Name = "node";
Node.Width = 100;
Node.Height = 100;
Collection Stops = new Collection();
Stops.Add(new Stop() { Color = "white", Offset = 0 });
Stops.Add(new Stop() { Color = "red", Offset = 50 });
Node.Gradient = new LinearGradient() { X1 = 0, X2 = 50, Y1 = 0, Y2 = 50, Stops = Stops };
Model.Nodes.Add(Node);
X2
Gets or sets the right most position(relative to node) of the rectangular region that needs to be painted
Declaration
[JsonProperty("x2")]
public double X2 { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 0 |
Examples
Node node = new Node();
Node.Name = "node";
Node.Width = 100;
Node.Height = 100;
Collection Stops = new Collection();
Stops.Add(new Stop() { Color = "white", Offset = 0 });
Stops.Add(new Stop() { Color = "red", Offset = 50 });
Node.Gradient = new LinearGradient() { X1 = 0, X2 = 50, Y1 = 0, Y2 = 50, Stops = Stops };
Model.Nodes.Add(Node);
Y1
Gets or sets the top most position(relative to node) of the rectangular region that needs to be painted
Declaration
[JsonProperty("y1")]
public double Y1 { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 0 |
Examples
Node Node = new Node();
Node.Name = "node";
Node.Width = 100;
Node.Height = 100;
Collection Stops = new Collection();
Stops.Add(new Stop() { Color = "white", Offset = 0 });
Stops.Add(new Stop() { Color = "red", Offset = 50 });
Node.Gradient = new LinearGradient() { X1 = 0, X2 = 50, Y1 = 0, Y2 = 50, Stops = Stops };
Model.Nodes.Add(Node);
Y2
Gets or sets the bottom most position(relative to node) of the rectangular region that needs to be painted
Declaration
[JsonProperty("y2")]
public double Y2 { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 0 |
Examples
Node Node = new Node();
Node.Name = "node";
Node.Width = 100;
Node.Height = 100;
Collection Stops = new Collection();
Stops.Add(new Stop() { Color = "white", Offset = 0 });
Stops.Add(new Stop() { Color = "red", Offset = 50 });
Node.Gradient = new LinearGradient() { X1 = 0, X2 = 50, Y1 = 0, Y2 = 50, Stops = Stops };
Model.Nodes.Add(Node);
Methods
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | Copy of the object this method is invoked against. |