Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Plot2DLayeredArea.cs
1using System;
2using SkiaSharp;
6
8{
20 {
21 private static readonly ArgumentType[] argumentTypes3Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector, ArgumentType.Scalar };
22 private static readonly ArgumentType[] argumentTypes2Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector };
23
33 : base(new ScriptNode[] { X, Y }, argumentTypes2Parameters, Start, Length, Expression)
34 {
35 }
36
47 : base(new ScriptNode[] { X, Y, Color, }, argumentTypes3Parameters, Start, Length, Expression)
48 {
49 }
50
54 public override string FunctionName => nameof(Plot2DLayeredArea);
55
59 public override string[] Aliases
60 {
61 get
62 {
63 return new string[] { "plot2dlayeredlinearea" };
64 }
65 }
66
70 public override string[] DefaultArgumentNames
71 {
72 get { return new string[] { "x", "y", "color" }; }
73 }
74
82 {
83 if (!(Arguments[0] is IVector X))
84 throw new ScriptRuntimeException("Expected vector for X argument.", this);
85
86 if (!(Arguments[1] is IVector Y))
87 throw new ScriptRuntimeException("Expected vector for Y argument.", this);
88
89 int Dimension = X.Dimension;
90 if (Y.Dimension != Dimension)
91 throw new ScriptRuntimeException("Vector size mismatch.", this);
92
93 IElement AreaColor = Arguments.Length <= 2 ? null : Arguments[2];
94
95 return new Graph2D(Variables, X, Y, new Plot2DLayeredAreaPainter(), false, true, this,
96 AreaColor?.AssociatedObjectValue ?? new SKColor(Graph.DefaultColor.Red, Graph.DefaultColor.Green, Graph.DefaultColor.Blue, 192));
97 }
98 }
99}
Class managing a script expression.
Definition: Expression.cs:39
Plots a two-dimensional layered area chart. https://en.wikipedia.org/wiki/Area_chart
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Plot2DLayeredArea(ScriptNode X, ScriptNode Y, ScriptNode Color, int Start, int Length, Expression Expression)
Plots a two-dimensional layered area chart.
override string[] Aliases
Optional aliases. If there are no aliases for the function, null is returned.
override string FunctionName
Name of the function
Plot2DLayeredArea(ScriptNode X, ScriptNode Y, int Start, int Length, Expression Expression)
Plots a two-dimensional layered area chart.
override string[] DefaultArgumentNames
Default Argument names
Plots a two-dimensional layered area chart. https://en.wikipedia.org/wiki/Area_chart
Handles two-dimensional graphs.
Definition: Graph2D.cs:26
Base class for graphs.
Definition: Graph.cs:79
static readonly SKColor DefaultColor
Default color: Red
Definition: Graph.cs:118
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
Expression Expression
Expression of which the node is a part.
Definition: ScriptNode.cs:177
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20
Basic interface for vectors.
Definition: IVector.cs:9
ArgumentType
Type of parameter used in a function definition or a lambda definition.
Definition: IFunction.cs:9