OxyPlot.Annotations.FunctionAnnotation.ps1
Set-StrictMode -Version 3 <# .SYNOPSIS Represents an annotation that shows a function rendered as a path. .PARAMETER Text Sets the annotation text. .PARAMETER TextPosition Sets the position of the text. If the value is DataPoint.Undefined, the default position of the text will be used. .PARAMETER TextHorizontalAlignment Sets the horizontal alignment of the text. .PARAMETER TextVerticalAlignment Sets the vertical alignment of the text. .PARAMETER TextRotation Sets the rotation of the text. .PARAMETER Layer Sets the rendering layer of the annotation. The default value is OxyPlot.Annotations.AnnotationLayer.AboveSeries. .PARAMETER XAxis Gets the X axis. .PARAMETER XAxisKey Sets the X axis key. .PARAMETER YAxis Gets the Y axis. .PARAMETER YAxisKey Sets the Y axis key. .PARAMETER Type Sets the type of function. Can be either f(x) or f(y). .PARAMETER Equation Sets the y=f(x) equation when Type is Equation. .PARAMETER Resolution Sets the resolution. .PARAMETER Color Sets the color of the line. .PARAMETER LineJoin Sets the line join. .PARAMETER LineStyle Sets the line style. .PARAMETER MaximumX Sets the maximum X coordinate for the line. .PARAMETER MaximumY Sets the maximum Y coordinate for the line. .PARAMETER MinimumX Sets the minimum X coordinate for the line. .PARAMETER MinimumY Sets the minimum Y coordinate for the line. .PARAMETER StrokeThickness Sets the stroke thickness. .PARAMETER TextMargin Sets the text margin (along the line). .PARAMETER TextPadding Sets the text padding (in the direction of the text). .PARAMETER TextOrientation Sets the text orientation. .PARAMETER TextLinePosition Sets the text position relative to the line. Positions smaller than 0.25 are left aligned at the start of the line Positions larger than 0.75 are right aligned at the end of the line Other positions are center aligned at the specified position .PARAMETER ClipText Sets a value indicating whether to clip the text within the plot area. .PARAMETER ClipByXAxis Sets a value indicating whether to clip the annotation line by the X axis range. .PARAMETER ClipByYAxis Sets a value indicating whether to clip the annotation line by the Y axis range. .PARAMETER Aliased Sets a value indicating whether the path is aliased. .PARAMETER ActualMinimumX Sets the actual minimum value on the x axis. .PARAMETER ActualMinimumY Sets the actual minimum value on the y axis. .PARAMETER ActualMaximumX Sets the actual maximum value on the x axis. .PARAMETER ActualMaximumY Sets the actual maximum value on the y axis. .PARAMETER Parent Gets the parent model of the element. .PARAMETER Font Sets the font. The default is null (use OxyPlot.PlotModel.DefaultFont. If the value is null, the DefaultFont of the parent PlotModel will be used. .PARAMETER FontSize Sets the size of the font. The default is double.NaN (use OxyPlot.PlotModel.DefaultFontSize). If the value is NaN, the DefaultFontSize of the parent PlotModel will be used. .PARAMETER FontWeight Sets the font weight. The default is FontWeights.Normal. .PARAMETER PlotModel Gets the parent OxyPlot.PlotElement.PlotModel. .PARAMETER Tag Sets an arbitrary object value that can be used to store custom information about this plot element. The default is null. This property is analogous to Tag properties in other Microsoft programming models. Tag is intended to provide a pre-existing property location where you can store some basic custom information about any PlotElement without requiring you to subclass an element. .PARAMETER TextColor Sets the color of the text. The default is OxyColors.Automatic (use OxyPlot.PlotModel.TextColor). If the value is OxyColors.Automatic, the TextColor of the parent PlotModel will be used. .PARAMETER ToolTip Sets the tool tip. The default is null. .PARAMETER ActualFont Gets the actual font. .PARAMETER ActualFontSize Gets the actual size of the font. .PARAMETER ActualFontWeight Gets the actual font weight. .PARAMETER ActualTextColor Gets the actual color of the text. .PARAMETER ActualCulture Gets the actual culture. The culture is defined in the parent PlotModel. .PARAMETER Selectable Sets a value indicating whether this element can be selected. The default is true. .PARAMETER SelectionMode Sets the selection mode of items in this element. The default is SelectionMode.All. This is only used by the select/unselect functionality, not by the rendering. .PARAMETER ActualSelectedColor Gets the actual selection color. .INPUTS #> function New-OxyFunctionAnnotation { [cmdletbinding()] [OutputType([OxyPlot.Annotations.FunctionAnnotation])] param( [OxyPlot.Annotations.FunctionAnnotationType]$Type, [System.Func[double,double]]$Equation, [int]$Resolution, [ValidatePattern('AliceBlue|AntiqueWhite|Aqua|Aquamarine|Automatic|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenrod|DarkGray|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGray|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGray|DodgerBlue|Firebrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|Goldenrod|Gray|Green|GreenYellow|Honeydew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenrodYellow|LightGray|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGray|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquamarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenrod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGray|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Undefined|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen|(#?[0-9a-f]{1,8})')][string]$Color, [OxyPlot.LineJoin]$LineJoin, [OxyPlot.LineStyle]$LineStyle, [double]$MaximumX, [double]$MaximumY, [double]$MinimumX, [double]$MinimumY, [double]$StrokeThickness, [double]$TextMargin, [double]$TextPadding, [OxyPlot.Annotations.AnnotationTextOrientation]$TextOrientation, [double]$TextLinePosition, [bool]$ClipText, [bool]$ClipByXAxis, [bool]$ClipByYAxis, [string]$Text, [OxyPlot.DataPoint]$TextPosition, [OxyPlot.HorizontalAlignment]$TextHorizontalAlignment, [OxyPlot.VerticalAlignment]$TextVerticalAlignment, [double]$TextRotation, [OxyPlot.Annotations.AnnotationLayer]$Layer, [string]$XAxisKey, [string]$YAxisKey, [string]$Font, [double]$FontSize, [double]$FontWeight, [System.Object]$Tag, [ValidatePattern('AliceBlue|AntiqueWhite|Aqua|Aquamarine|Automatic|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenrod|DarkGray|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGray|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGray|DodgerBlue|Firebrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|Goldenrod|Gray|Green|GreenYellow|Honeydew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenrodYellow|LightGray|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGray|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquamarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenrod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGray|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Undefined|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen|(#?[0-9a-f]{1,8})')][string]$TextColor, [string]$ToolTip, [bool]$Selectable, [OxyPlot.SelectionMode]$SelectionMode, [OxyPlot.Model]$Parent, [hashtable]$Options = @{}, [string]$Style = "default", [OxyPlot.PlotModel]$AddTo ) $a = New-Object OxyPlot.Annotations.FunctionAnnotation foreach ($key in $Options.Keys) { $a.$key = $Options[$key] } if ($PSBoundParameters.ContainsKey('Type')) { $a.Type = $Type } if ($PSBoundParameters.ContainsKey('Equation')) { $a.Equation = $Equation } if ($PSBoundParameters.ContainsKey('Resolution')) { $a.Resolution = $Resolution } if ($PSBoundParameters.ContainsKey('Color')) { $a.Color = New-OxyColor $Color } if ($PSBoundParameters.ContainsKey('LineJoin')) { $a.LineJoin = $LineJoin } if ($PSBoundParameters.ContainsKey('LineStyle')) { $a.LineStyle = $LineStyle } if ($PSBoundParameters.ContainsKey('MaximumX')) { $a.MaximumX = $MaximumX } if ($PSBoundParameters.ContainsKey('MaximumY')) { $a.MaximumY = $MaximumY } if ($PSBoundParameters.ContainsKey('MinimumX')) { $a.MinimumX = $MinimumX } if ($PSBoundParameters.ContainsKey('MinimumY')) { $a.MinimumY = $MinimumY } if ($PSBoundParameters.ContainsKey('StrokeThickness')) { $a.StrokeThickness = $StrokeThickness } if ($PSBoundParameters.ContainsKey('TextMargin')) { $a.TextMargin = $TextMargin } if ($PSBoundParameters.ContainsKey('TextPadding')) { $a.TextPadding = $TextPadding } if ($PSBoundParameters.ContainsKey('TextOrientation')) { $a.TextOrientation = $TextOrientation } if ($PSBoundParameters.ContainsKey('TextLinePosition')) { $a.TextLinePosition = $TextLinePosition } if ($PSBoundParameters.ContainsKey('ClipText')) { $a.ClipText = $ClipText } if ($PSBoundParameters.ContainsKey('ClipByXAxis')) { $a.ClipByXAxis = $ClipByXAxis } if ($PSBoundParameters.ContainsKey('ClipByYAxis')) { $a.ClipByYAxis = $ClipByYAxis } if ($PSBoundParameters.ContainsKey('Text')) { $a.Text = $Text } if ($PSBoundParameters.ContainsKey('TextPosition')) { $a.TextPosition = $TextPosition } if ($PSBoundParameters.ContainsKey('TextHorizontalAlignment')) { $a.TextHorizontalAlignment = $TextHorizontalAlignment } if ($PSBoundParameters.ContainsKey('TextVerticalAlignment')) { $a.TextVerticalAlignment = $TextVerticalAlignment } if ($PSBoundParameters.ContainsKey('TextRotation')) { $a.TextRotation = $TextRotation } if ($PSBoundParameters.ContainsKey('Layer')) { $a.Layer = $Layer } if ($PSBoundParameters.ContainsKey('XAxisKey')) { $a.XAxisKey = $XAxisKey } if ($PSBoundParameters.ContainsKey('YAxisKey')) { $a.YAxisKey = $YAxisKey } if ($PSBoundParameters.ContainsKey('Font')) { $a.Font = $Font } if ($PSBoundParameters.ContainsKey('FontSize')) { $a.FontSize = $FontSize } if ($PSBoundParameters.ContainsKey('FontWeight')) { $a.FontWeight = $FontWeight } if ($PSBoundParameters.ContainsKey('Tag')) { $a.Tag = $Tag } if ($PSBoundParameters.ContainsKey('TextColor')) { $a.TextColor = New-OxyColor $TextColor } if ($PSBoundParameters.ContainsKey('ToolTip')) { $a.ToolTip = $ToolTip } if ($PSBoundParameters.ContainsKey('Selectable')) { $a.Selectable = $Selectable } if ($PSBoundParameters.ContainsKey('SelectionMode')) { $a.SelectionMode = $SelectionMode } if ($PSBoundParameters.ContainsKey('Parent')) { $a.Parent = $Parent } if ($AddTo -ne $null) { $AddTo.Annotations.Add($a) $AddTo.InvalidatePlot($false) } else { $a } } |