Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Scatter2D.cs
5
7{
17 {
18 private static readonly ArgumentType[] argumentTypes4Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar };
19 private static readonly ArgumentType[] argumentTypes3Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector, ArgumentType.Scalar };
20 private static readonly ArgumentType[] argumentTypes2Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector };
21
31 : base(new ScriptNode[] { X, Y }, argumentTypes2Parameters, Start, Length, Expression)
32 {
33 }
34
45 : base(new ScriptNode[] { X, Y, Color }, argumentTypes3Parameters, Start, Length, Expression)
46 {
47 }
48
60 : base(new ScriptNode[] { X, Y, Color, Size }, argumentTypes4Parameters, Start, Length, Expression)
61 {
62 }
63
67 public override string FunctionName => nameof(Scatter2D);
68
72 public override string[] DefaultArgumentNames
73 {
74 get { return new string[] { "x", "y", "color", "size" }; }
75 }
76
84 {
85 if (!(Arguments[0] is IVector X))
86 throw new ScriptRuntimeException("Expected vector for X argument.", this);
87
88 if (!(Arguments[1] is IVector Y))
89 throw new ScriptRuntimeException("Expected vector for Y argument.", this);
90
91 int Dimension = X.Dimension;
92 if (Y.Dimension != Dimension)
94
95 IElement Color = Arguments.Length <= 2 ? null : Arguments[2];
96 IElement Size = Arguments.Length <= 3 ? null : Arguments[3];
97
98 return new Graph2D(Variables, X, Y, new Scatter2DPainter(), false, false, this,
99 Color?.AssociatedObjectValue ?? Graph.DefaultColor, Size?.AssociatedObjectValue ?? 5.0);
100 }
101 }
102}
Class managing a script expression.
Definition: Expression.cs:41
Plots a two-dimensional scatter graph.
Definition: Scatter2D.cs:17
override string[] DefaultArgumentNames
Default Argument names
Definition: Scatter2D.cs:73
override string FunctionName
Name of the function
Definition: Scatter2D.cs:67
Scatter2D(ScriptNode X, ScriptNode Y, ScriptNode Color, int Start, int Length, Expression Expression)
Plots a two-dimensional scatter graph.
Definition: Scatter2D.cs:44
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Definition: Scatter2D.cs:83
Scatter2D(ScriptNode X, ScriptNode Y, ScriptNode Color, ScriptNode Size, int Start, int Length, Expression Expression)
Plots a two-dimensional scatter graph.
Definition: Scatter2D.cs:59
Scatter2D(ScriptNode X, ScriptNode Y, int Start, int Length, Expression Expression)
Plots a two-dimensional scatter graph.
Definition: Scatter2D.cs:30
Plots a two-dimensional scatter graph.
Handles two-dimensional graphs.
Definition: Graph2D.cs:27
Base class for graphs.
Definition: Graph.cs:88
static readonly SKColor DefaultColor
Default color: Red
Definition: Graph.cs:127
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:21
object AssociatedObjectValue
Associated object value.
Definition: IElement.cs:34
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