Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Plot2DArea.cs
1using System;
2using SkiaSharp;
7
9{
21 {
22 private static readonly ArgumentType[] argumentTypes3Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector, ArgumentType.Scalar };
23 private static readonly ArgumentType[] argumentTypes2Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector };
24
34 : base(new ScriptNode[] { X, Y }, argumentTypes2Parameters, Start, Length, Expression)
35 {
36 }
37
48 : base(new ScriptNode[] { X, Y, Color, }, argumentTypes3Parameters, Start, Length, Expression)
49 {
50 }
51
55 public override string FunctionName => nameof(Plot2DArea);
56
60 public override string[] Aliases
61 {
62 get
63 {
64 return new string[] { "plot2dlinearea" };
65 }
66 }
67
71 public override string[] DefaultArgumentNames
72 {
73 get { return new string[] { "x", "y", "color" }; }
74 }
75
83 {
84 if (!(Arguments[0] is IVector X))
85 throw new ScriptRuntimeException("Expected vector for X argument.", this);
86
87 if (!(Arguments[1] is IVector Y))
88 throw new ScriptRuntimeException("Expected vector for Y argument.", this);
89
90 int Dimension = X.Dimension;
91 if (Y.Dimension != Dimension)
93
94 IElement AreaColor = Arguments.Length <= 2 ? null : Arguments[2];
95
96 return new Graph2D(Variables, X, Y, new Plot2DAreaPainter(), false, true, this,
97 AreaColor?.AssociatedObjectValue ?? new SKColor(Graph.DefaultColor.Red, Graph.DefaultColor.Green, Graph.DefaultColor.Blue, 192));
98 }
99 }
100}
Class managing a script expression.
Definition: Expression.cs:41
Plots a two-dimensional stacked area chart. https://en.wikipedia.org/wiki/Area_chart
Definition: Plot2DArea.cs:21
override string[] DefaultArgumentNames
Default Argument names
Definition: Plot2DArea.cs:72
override string FunctionName
Name of the function
Definition: Plot2DArea.cs:55
override string[] Aliases
Optional aliases. If there are no aliases for the function, null is returned.
Definition: Plot2DArea.cs:61
Plot2DArea(ScriptNode X, ScriptNode Y, int Start, int Length, Expression Expression)
Plots a two-dimensional stacked area chart.
Definition: Plot2DArea.cs:33
Plot2DArea(ScriptNode X, ScriptNode Y, ScriptNode Color, int Start, int Length, Expression Expression)
Plots a two-dimensional stacked area chart.
Definition: Plot2DArea.cs:47
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Definition: Plot2DArea.cs:82
Plots a two-dimensional stacked area chart. https://en.wikipedia.org/wiki/Area_chart
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
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