2using System.Collections;
3using System.Collections.Generic;
4using System.Globalization;
6using System.Threading.Tasks;
27 private LinkedList<IVector> x =
new LinkedList<IVector>();
28 private LinkedList<IVector> y =
new LinkedList<IVector>();
29 private readonly LinkedList<object[]> parameters =
new LinkedList<object[]>();
30 private readonly LinkedList<IPainter2D> painters =
new LinkedList<IPainter2D>();
33 private Type axisTypeX;
34 private Type axisTypeY;
35 private string title =
string.Empty;
36 private string labelX =
string.Empty;
37 private string labelY =
string.Empty;
38 private bool showXAxis =
true;
39 private bool showYAxis =
true;
40 private bool showGrid =
true;
41 private bool elementwise =
false;
61 : base(
Variables, DefaultWidth, DefaultHeight)
95 int i, c =
X.Dimension;
100 if (c !=
Y.Dimension)
103 for (i = 0; i < c; i++)
105 ex =
X.GetElement(i);
106 ey =
Y.GetElement(i);
123 Zero = AG.AdditiveIdentity;
134 Zero = AG2.AdditiveIdentity;
142 LinkedList<IElement> X2 =
new LinkedList<IElement>();
143 LinkedList<IElement> Y2 =
new LinkedList<IElement>();
145 this.axisTypeX =
null;
146 this.axisTypeY =
null;
148 for (i = 0; i < c; i++)
150 ex =
X.GetElement(i);
151 ey =
Y.GetElement(i);
155 if (!(X2.First is
null))
157 this.AddSegment(
X,
Y, X2, Y2, Node, Painter,
Parameters);
158 X2 =
new LinkedList<IElement>();
159 Y2 =
new LinkedList<IElement>();
169 if (!(X2.First is
null))
170 this.AddSegment(
X,
Y, X2, Y2, Node, Painter,
Parameters);
174 this.axisTypeX =
X.GetType();
175 this.axisTypeY =
Y.GetType();
181 this.painters.AddLast(Painter);
187 private void AddSegment(
IVector X,
IVector Y, ICollection<IElement> X2, ICollection<IElement> Y2,
193 if (this.axisTypeX is
null)
195 this.axisTypeX = X2V.GetType();
196 this.axisTypeY = Y2V.GetType();
198 else if (X2V.GetType() != this.axisTypeX || Y2V.GetType() != this.axisTypeY)
203 this.painters.AddLast(Painter);
210 public LinkedList<IVector>
X => this.x;
215 public LinkedList<IVector>
Y => this.y;
253 set => this.title = value;
262 set => this.labelX = value;
271 set => this.labelY = value;
279 get => this.showXAxis;
280 set => this.showXAxis = value;
288 get => this.showYAxis;
289 set => this.showYAxis = value;
297 get => this.showGrid;
298 set => this.showGrid = value;
318 return this.
AddRight(Element,
false);
328 return Element.AddRightElementWise(
this);
349 if (this.x.First is
null)
355 if (G.x.First is
null)
364 axisTypeX = this.axisTypeX,
365 axisTypeY = this.axisTypeY,
367 labelX = this.labelX,
368 labelY = this.labelY,
379 Result.painters.AddLast(Painter);
381 foreach (
object[] P
in this.parameters)
382 Result.parameters.AddLast(P);
384 if (G.axisTypeX !=
this.axisTypeX || G.axisTypeY !=
this.axisTypeY)
393 ElementwiseAccumulatedAddition(ref Result.x, ref Result.y, G.x, G.y, ref Result.minX, ref Result.maxX, ref Result.minY, ref Result.maxY, G.minX, G.maxX);
395 ElementwiseAccumulatedAddition(ref Result.y, ref Result.x, G.y, G.x, ref Result.minY, ref Result.maxY, ref Result.minX, ref Result.maxX, G.minY, G.maxY);
415 Result.painters.AddLast(Painter);
417 foreach (
object[] P
in G.parameters)
418 Result.parameters.AddLast(P);
420 Result.showXAxis |= G.showXAxis;
421 Result.showYAxis |= G.showYAxis;
422 Result.elementwise = ElementWise;
427 private static void ElementwiseAccumulatedAddition(ref LinkedList<IVector> DestFixed, ref LinkedList<IVector> DestValues,
428 LinkedList<IVector> AddFixed, LinkedList<IVector> AddValues, ref
IElement MinFixed, ref
IElement MaxFixed,
431 Dictionary<string, IElement> Values =
new Dictionary<string, IElement>();
432 IEnumerator<IVector> vX = DestFixed.GetEnumerator();
433 IEnumerator<IVector> vY = DestValues.GetEnumerator();
434 IEnumerator<IElement> eX;
435 IEnumerator<IElement> eY;
438 LinkedList<IElement> Y2;
440 while (vX.MoveNext() && vY.MoveNext())
445 eX =
X.ChildElements.GetEnumerator();
446 eY =
Y.ChildElements.GetEnumerator();
448 while (eX.MoveNext() && eY.MoveNext())
449 Values[eX.Current.AssociatedObjectValue?.ToString() ??
string.Empty] = eY.Current;
452 vX = AddFixed.GetEnumerator();
453 vY = AddValues.GetEnumerator();
455 while (vX.MoveNext() && vY.MoveNext())
459 Y2 =
new LinkedList<IElement>();
461 eX =
X.ChildElements.GetEnumerator();
462 eY =
Y.ChildElements.GetEnumerator();
464 while (eX.MoveNext() && eY.MoveNext())
466 if (Values.TryGetValue(eX.Current.AssociatedObjectValue?.ToString() ??
string.Empty, out
IElement Value))
467 Y2.AddLast(Operators.Arithmetics.Add.EvaluateAddition(Value, eY.Current,
null));
469 Y2.AddLast(eY.Current);
472 DestFixed.AddLast(
X);
473 DestValues.AddLast(
Y = (
IVector)
Y.Encapsulate(Y2,
null));
484 LinkedList<IVector> NormalizedX =
new LinkedList<IVector>();
485 LinkedList<IVector> NormalizedY =
new LinkedList<IVector>();
486 Dictionary<string, IElement> Sorted =
new Dictionary<string, IElement>();
489 vX = DestFixed.GetEnumerator();
490 vY = DestValues.GetEnumerator();
492 while (vX.MoveNext() && vY.MoveNext())
496 Y2 =
new LinkedList<IElement>();
498 eX =
X.ChildElements.GetEnumerator();
499 eY =
Y.ChildElements.GetEnumerator();
501 while (eX.MoveNext() && eY.MoveNext())
502 Sorted[eX.Current.AssociatedObjectValue?.ToString() ??
string.Empty] = eY.Current;
504 foreach (
string s
in Strings)
506 if (Sorted.TryGetValue(s, out
IElement E))
512 NormalizedX.AddLast(Labels);
513 NormalizedY.AddLast((
IVector)
Y.Encapsulate(Y2,
null));
516 DestFixed = NormalizedX;
517 DestValues = NormalizedY;
527 this.minX.Equals(G.minX) &&
528 this.maxX.Equals(G.maxX) &&
529 this.minY.Equals(G.minY) &&
530 this.maxY.Equals(G.maxY) &&
531 this.axisTypeX.Equals(G.axisTypeX) &&
532 this.axisTypeY.Equals(G.axisTypeY) &&
533 this.title.Equals(G.title) &&
534 this.labelX.Equals(G.labelX) &&
535 this.labelY.Equals(G.labelY) &&
536 this.showXAxis.Equals(G.showXAxis) &&
537 this.showYAxis.Equals(G.showYAxis) &&
538 this.showGrid.Equals(G.showGrid) &&
539 this.Equals(
this.x.GetEnumerator(), G.x.GetEnumerator()) &&
540 this.Equals(
this.y.GetEnumerator(), G.y.GetEnumerator()) &&
541 this.Equals(
this.parameters.GetEnumerator(), G.parameters.GetEnumerator()) &&
542 this.Equals(
this.painters.GetEnumerator(), G.painters.GetEnumerator()));
545 private bool Equals(IEnumerator e1, IEnumerator e2)
547 bool b1 = e1.MoveNext();
548 bool b2 = e2.MoveNext();
552 if (!e1.Current.Equals(e2.Current))
565 int Result = this.minX.GetHashCode();
566 Result ^= Result << 5 ^ this.maxX.GetHashCode();
567 Result ^= Result << 5 ^ this.minY.GetHashCode();
568 Result ^= Result << 5 ^ this.maxY.GetHashCode();
569 Result ^= Result << 5 ^ this.axisTypeX.GetHashCode();
570 Result ^= Result << 5 ^ this.axisTypeY.GetHashCode();
571 Result ^= Result << 5 ^ this.title.GetHashCode();
572 Result ^= Result << 5 ^ this.labelX.GetHashCode();
573 Result ^= Result << 5 ^ this.labelY.GetHashCode();
574 Result ^= Result << 5 ^ this.showXAxis.GetHashCode();
575 Result ^= Result << 5 ^ this.showYAxis.GetHashCode();
576 Result ^= Result << 5 ^ this.showGrid.GetHashCode();
579 Result ^= Result << 5 ^ E.GetHashCode();
582 Result ^= Result << 5 ^ E.GetHashCode();
584 foreach (
object Obj
in this.parameters)
585 Result ^= Result << 5 ^ Obj.GetHashCode();
588 Result ^= Result << 5 ^ Painter.GetHashCode();
602 using (SKSurface Surface = SKSurface.Create(
new SKImageInfo(
Settings.
Width,
Settings.
Height, SKImageInfo.PlatformColorType, SKAlphaType.Premul)))
604 SKCanvas Canvas = Surface.Canvas;
606 States =
new object[0];
610 int x1, y1, x2, y2, x3, y3, w, h;
617 if (!
string.IsNullOrEmpty(this.labelY))
618 x1 += (
int)(Settings.LabelFontSize * 2 + 0.5);
620 if (!
string.IsNullOrEmpty(this.labelX))
621 y2 -= (
int)(Settings.LabelFontSize * 2 + 0.5);
623 if (!
string.IsNullOrEmpty(this.title))
624 y1 += (
int)(Settings.LabelFontSize * 2 + 0.5);
627 string[] YLabelStrings =
LabelStrings(YLabels, YLabelType);
628 SKPaint Font =
new SKPaint()
630 FilterQuality = SKFilterQuality.High,
631 HintingLevel = SKPaintHinting.Full,
634 Style = SKPaintStyle.Fill,
636 Typeface = SKTypeface.FromFamilyName(
Settings.
FontName, SKFontStyle.Normal),
639 SKRect Bounds =
new SKRect();
647 Font.MeasureText(
LabelString(Label, YLabelType), ref Bounds);
657 string[] XLabelStrings =
LabelStrings(XLabels, XLabelType);
664 Font.MeasureText(
LabelString(Label, XLabelType), ref Bounds);
665 Size = Bounds.Height;
675 SKPaint AxisBrush =
new SKPaint()
677 FilterQuality = SKFilterQuality.High,
679 Style = SKPaintStyle.Fill,
680 Color = Settings.AxisColor
682 SKPaint GridBrush =
new SKPaint()
684 FilterQuality = SKFilterQuality.High,
686 Style = SKPaintStyle.Fill,
687 Color = Settings.GridColor
689 SKPaint AxisPen =
new SKPaint()
691 FilterQuality = SKFilterQuality.High,
693 Style = SKPaintStyle.Stroke,
695 StrokeWidth = Settings.AxisWidth
697 SKPaint GridPen =
new SKPaint()
699 FilterQuality = SKFilterQuality.High,
701 Style = SKPaintStyle.Stroke,
703 StrokeWidth = Settings.GridWidth
707 this.minX.AssociatedObjectValue is
double MinX &&
714 double SX = w / (DX == 0 ? 1 : DX);
715 double SY = h / (DY == 0 ? 1 : DY);
719 int h2 = (int)(h * SX / SY + 0.5);
725 int w2 = (int)(w * SY / SX + 0.5);
735 OrigoX =
Scale(
new ObjectVector(AgX.AdditiveIdentity),
this.minX,
this.maxX, x3, w,
null)[0];
740 OrigoY =
Scale(
new ObjectVector(AgY.AdditiveIdentity),
this.minY,
this.maxY, y3, -h,
null)[0];
744 DrawingArea DrawingArea =
new DrawingArea(this.minX, this.maxX, this.minY, this.maxY, x3, y3, w, -h, (
float)OrigoX, (
float)OrigoY, this.elementwise);
746 Dictionary<string, double> YLabelPositions = YLabelType == LabelType.String ?
new Dictionary<string, double>() :
null;
754 s = YLabelStrings[i];
755 Font.MeasureText(s, ref Bounds);
759 if (!(YLabelPositions is
null))
760 YLabelPositions[s] = d;
765 Canvas.DrawLine(x3, f, x2, f, AxisPen);
767 Canvas.DrawLine(x3, f, x2, f, GridPen);
772 f += Bounds.Height * 0.5f;
778 Dictionary<string, double> XLabelPositions = XLabelType == LabelType.String ?
new Dictionary<string, double>() :
null;
783 s = XLabelStrings[i];
784 Font.MeasureText(s, ref Bounds);
788 if (!(XLabelPositions is
null))
789 XLabelPositions[s] = d;
794 Canvas.DrawLine(f, y1, f, y3, AxisPen);
796 Canvas.DrawLine(f, y1, f, y3, GridPen);
805 else if (f + Size > x3 + w)
812 DrawingArea.XLabelPositions = XLabelPositions;
813 DrawingArea.YLabelPositions = YLabelPositions;
820 FilterQuality = SKFilterQuality.High,
821 HintingLevel = SKPaintHinting.Full,
824 Style = SKPaintStyle.Fill,
830 if (!
string.IsNullOrEmpty(this.title))
832 Font.MeasureText(this.title, ref Bounds);
835 f = x3 + (x2 - x3 - Size) * 0.5f;
839 else if (f + Size > x3 + w)
842 Canvas.DrawText(this.title, f, (
float)(Settings.MarginTop + 0.1 * Settings.LabelFontSize - Bounds.Top), Font);
845 if (!
string.IsNullOrEmpty(this.labelX))
847 Font.MeasureText(this.labelX, ref Bounds);
850 f = x3 + (x2 - x3 - Size) * 0.5f;
854 else if (f + Size > x3 + w)
857 Canvas.DrawText(this.labelX, f, (
float)(Settings.Height - Settings.MarginBottom - 0.1 * Settings.LabelFontSize - Bounds.Height - Bounds.Top), Font);
860 if (!
string.IsNullOrEmpty(this.labelY))
862 Font.MeasureText(this.labelY, ref Bounds);
865 f = y3 - (y3 - y1 - Size) * 0.5f;
872 Canvas.Translate((
float)(Settings.MarginLeft + 0.1 * Settings.LabelFontSize - Bounds.Top), f);
873 Canvas.RotateDegrees(-90);
874 Canvas.DrawText(this.labelY, 0, 0, Font);
875 Canvas.ResetMatrix();
878 IEnumerator<IVector> ex = this.x.GetEnumerator();
879 IEnumerator<IVector> ey = this.y.GetEnumerator();
880 IEnumerator<object[]> eParameters = this.parameters.GetEnumerator();
881 IEnumerator<IPainter2D> ePainters = this.painters.GetEnumerator();
883 SKPoint[] PrevPoints =
null;
884 object[] PrevParameters =
null;
887 while (ex.MoveNext() && ey.MoveNext() && eParameters.MoveNext() && ePainters.MoveNext())
891 if (!(PrevPainter is
null) && ePainters.Current.GetType() == PrevPainter.GetType())
892 ePainters.Current.DrawGraph(Canvas, Points, eParameters.Current, PrevPoints, PrevParameters,
DrawingArea);
894 ePainters.Current.DrawGraph(Canvas, Points, eParameters.Current,
null,
null,
DrawingArea);
897 PrevParameters = eParameters.Current;
898 PrevPainter = ePainters.Current;
901 using (SKImage Result = Surface.Snapshot())
931 return "[" + X2.ToString() +
"," + Y2.ToString() +
"]";
940 Output.WriteStartElement(
"Graph2D");
941 Output.WriteAttributeString(
"title", this.title);
942 Output.WriteAttributeString(
"labelX", this.labelX);
943 Output.WriteAttributeString(
"labelY", this.labelY);
944 Output.WriteAttributeString(
"axisTypeX", this.axisTypeX?.FullName);
945 Output.WriteAttributeString(
"axisTypeY", this.axisTypeY?.FullName);
950 Output.WriteAttributeString(
"showXAxis", this.showXAxis ?
"true" :
"false");
951 Output.WriteAttributeString(
"showYAxis", this.showYAxis ?
"true" :
"false");
952 Output.WriteAttributeString(
"showGrid", this.showGrid ?
"true" :
"false");
954 Dictionary<string, string> Series =
new Dictionary<string, string>();
962 if (Series.TryGetValue(s, out Label))
963 Output.WriteElementString(
"X", Label);
966 Label =
"X" + (i++).ToString();
968 Output.WriteElementString(
"X", Label +
":=" + s);
977 if (Series.TryGetValue(s, out Label))
978 Output.WriteElementString(
"Y", Label);
981 Label =
"Y" + (i++).ToString();
983 Output.WriteElementString(
"Y", Label +
":=" + s);
989 foreach (
object[] v
in this.parameters)
992 if (Series.TryGetValue(s, out Label))
993 Output.WriteElementString(
"Parameters", Label);
996 Label =
"P" + (i++).ToString();
998 Output.WriteElementString(
"Parameters", Label +
":=" + s);
1002 foreach (
IPainter2D Painter
in this.painters)
1003 Output.WriteElementString(
"Painter", Painter.GetType().FullName);
1005 Output.WriteEndElement();
1016 return ((
float)Value).ToString().Replace(NumberFormatInfo.CurrentInfo.NumberDecimalSeparator,
".");
1027 StringBuilder sb =
null;
1029 foreach (
double d
in Value.Values)
1032 sb =
new StringBuilder(
"[");
1036 sb.Append(((
float)d).ToString().Replace(NumberFormatInfo.CurrentInfo.NumberDecimalSeparator,
"."));
1044 return sb.ToString();
1056 StringBuilder sb =
null;
1058 foreach (DateTime d
in Value.Values)
1061 sb =
new StringBuilder(
"DateTime([");
1066 int Month = d.Month;
1069 int Minute = d.Minute;
1070 int Second = d.Second;
1071 int MSecond = d.Millisecond;
1093 sb.Append(Year.ToString());
1099 sb.Append(Month.ToString());
1105 sb.Append(Day.ToString());
1111 sb.Append(Hour.ToString());
1117 sb.Append(Minute.ToString());
1123 sb.Append(Second.ToString());
1129 sb.Append(MSecond.ToString());
1137 if (d.Kind == DateTimeKind.Utc)
1148 return sb.ToString();
1160 StringBuilder sb =
null;
1162 foreach (
IElement E
in Value.Values)
1168 sb =
new StringBuilder(
"TimeSpan([");
1173 int Hours = TS.Hours;
1174 int Minutes = TS.Minutes;
1175 int Seconds = TS.Seconds;
1176 int MSeconds = TS.Milliseconds;
1193 if (Days != 0 || Mask == 0)
1194 sb.Append(Days.ToString());
1203 sb.Append(Hours.ToString());
1209 sb.Append(Minutes.ToString());
1215 sb.Append(Seconds.ToString());
1221 sb.Append(MSeconds.ToString());
1235 return sb.ToString();
1253 else if (Value is
ObjectVector ov && IsTimeSpanVector(ov))
1278 foreach (XmlAttribute Attr
in Xml.Attributes)
1283 this.title = Attr.Value;
1287 this.labelX = Attr.Value;
1291 this.labelY = Attr.Value;
1319 this.showXAxis = Attr.Value ==
"true";
1323 this.showYAxis = Attr.Value ==
"true";
1327 this.showGrid = Attr.Value ==
"true";
1332 foreach (XmlNode N
in Xml.ChildNodes)
1334 if (N is XmlElement E)
1336 switch (E.LocalName)
1366 IEnumerator<object[]> eParameters = this.parameters.GetEnumerator();
1367 IEnumerator<IPainter2D> ePainter = this.painters.GetEnumerator();
1369 while (eParameters.MoveNext() && ePainter.MoveNext())
1371 if (!ePainter.Current.UsesDefaultColor(eParameters.Current))
1389 IEnumerator<object[]> eParameters = this.parameters.GetEnumerator();
1390 IEnumerator<IPainter2D> ePainter = this.painters.GetEnumerator();
1393 while (eParameters.MoveNext() && ePainter.MoveNext())
1395 if (!ePainter.Current.TrySetDefaultColor(Color, eParameters.Current))
Static class that dynamically manages types and interfaces available in the runtime environment.
static Type GetType(string FullName)
Gets a type, given its full name.
Base class for all types of elements.
Element()
Base class for all types of elements.
virtual ICollection< IElement > VectorElements
An enumeration of vector elements.
Base class for all types of groups.
Base class for script exceptions.
Class managing a script expression.
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
static double CalcMax(double[] Values, ScriptNode Node)
Returns the largest value.
static double CalcMin(double[] Values, ScriptNode Node)
Returns the smallest value.
Contains information about the current drawing area.
IElement DescaleY(double Value)
Descales a scaled value along the Y-axis.
SKPoint[] Scale(IVector VectorX, IVector VectorY)
Scales two vectors of equal size to points in a rectangular area.
IElement DescaleX(double Value)
Descales a scaled value along the X-axis.
double[] ScaleX(IVector Vector)
Scales a vector to fit a given area.
double[] ScaleY(IVector Vector)
Scales a vector to fit a given area.
Handles two-dimensional graphs.
override ISemiGroupElementWise AddRightElementWise(ISemiGroupElementWise Element)
Tries to add an element to the current element, from the right, element-wise.
IElement MinX
Smallest X-value.
static string ReducedXmlString(double Value)
Generates an XML value string of an element, possible with reduced resolution, to avoid unnecessary d...
ISemiGroupElement AddRight(ISemiGroupElement Element, bool ElementWise)
Tries to add an element to the current element, from the right.
string Title
Title for graph.
bool ShowXAxis
If the X-axis is to be displayed.
override void ExportGraph(XmlWriter Output)
Exports graph specifics to XML.
bool ShowYAxis
If the Y-axis is to be displayed.
override ISemiGroupElement AddLeft(ISemiGroupElement Element)
Tries to add an element to the current element, from the left.
static string ReducedXmlStringTimeSpans(ObjectVector Value)
Generates an XML value string of an element, possible with reduced resolution, to avoid unnecessary d...
IElement MinY
Smallest Y-value.
override bool Equals(object obj)
Compares the element to another. If elements are equal.
override bool UsesDefaultColor
If graph uses default color
IElement MaxX
Largest X-value.
override ISemiGroupElementWise AddLeftElementWise(ISemiGroupElementWise Element)
Tries to add an element to the current element, from the left, element-wise.
static string ReducedXmlString(DateTimeVector Value)
Generates an XML value string of an element, possible with reduced resolution, to avoid unnecessary d...
static string ReducedXmlString(DoubleVector Value)
Generates an XML value string of an element, possible with reduced resolution, to avoid unnecessary d...
override PixelInformation CreatePixels(GraphSettings Settings, out object[] States)
Creates a bitmap of the graph.
override string GetBitmapClickScript(double X, double Y, object[] States)
Gets script corresponding to a point in a generated bitmap representation of the graph.
LinkedList< object[]> Parameters
Parameters.
string LabelY
Label for y-axis.
override bool TrySetDefaultColor(SKColor Color)
Tries to set the default color.
Graph2D(Variables Variables, IVector X, IVector Y, IPainter2D Painter, bool ShowZeroX, bool ShowZeroY, ScriptNode Node, params object[] Parameters)
Base class for two-dimensional graphs.
LinkedList< IVector > Y
Y-axis series.
IElement MaxY
Largest Y-value.
override int GetHashCode()
Calculates a hash code of the element. Hash code.
LinkedList< IVector > X
X-axis series.
override ISemiGroupElement AddRight(ISemiGroupElement Element)
Tries to add an element to the current element, from the right.
Graph2D(Variables Variables, int? DefaultWidth, int? DefaultHeight)
Base class for two-dimensional graphs.
Graph2D(GraphSettings Settings)
Base class for two-dimensional graphs.
Graph2D(Variables Variables)
Base class for two-dimensional graphs.
override async Task ImportGraphAsync(XmlElement Xml)
Imports graph specifics from XML.
static string ReducedXmlString(IElement Value)
Generates an XML value string of an element, possible with reduced resolution, to avoid unnecessary d...
bool Elementwise
If graph was generated using element-wise addition operations.
bool ShowGrid
If the grid is to be displayed.
string LabelX
Label for x-axis.
bool SameScale
If the same scale should be used for all axes.
object[] ToObjectArray(IVector v)
Gets an array of objects corresponding to the elements of a vector.
static string[] LabelStrings(IVector Labels, LabelType LabelType)
Converts a vector of labels to a string array.
static IVector GetLabels(ref IElement Min, ref IElement Max, IEnumerable< IVector > Series, int ApproxNrLabels, out LabelType LabelType)
Gets label values for a series vector.
static SKPoint[] Scale(IVector VectorX, IVector VectorY, IElement MinX, IElement MaxX, IElement MinY, IElement MaxY, double OffsetX, double OffsetY, double Width, double Height, Dictionary< string, double > XLabelPositions, Dictionary< string, double > YLabelPositions)
Scales two vectors of equal size to points in a rectangular area.
GraphSettings Settings
Graph settings available during creation.
static string LabelString(IElement Label, LabelType LabelType)
Converts a label to a string.
static async Task< IElement > ParseAsync(string s, Variables Variables)
Parses an element expression string.
SKColor AxisColor
Axis color.
SKColor BackgroundColor
Background color.
int ApproxNrLabelsY
Approximate number of labels along the Y-axis.
int MarginLabel
Label margin.
int MarginRight
Right margin.
int ApproxNrLabelsX
Approximate number of labels along the X-axis.
int MarginLeft
Left margin.
int MarginBottom
Bottom margin.
double LabelFontSize
Label font size
SKColor GridColor
Grid color.
int Width
Width of graph, in pixels. (Default=640 pixels.)
int Height
Height of graph, in pixels. (Default=480 pixels.)
string FontName
Font name.
Base class for all nodes in a parsed script tree.
static readonly DoubleNumber ZeroElement
0
static IElement Encapsulate(Array Elements, bool CanEncapsulateAsMatrix, ScriptNode Node)
Encapsulates the elements of a vector.
Basic interface for all types of elements.
object AssociatedObjectValue
Associated object value.
ICollection< IElement > ChildElements
An enumeration of child elements. If the element is a scalar, this property will return null.
ISet AssociatedSet
Associated Set.
Basic interface for all types of semigroup elements.
Basic interface for all types of element-wise semigroup elements.
Basic interface for vectors.
Basic interface for all types of abelian groups.
Interface for 2D graph drawing functions.