OxyPlot.Series.ContourSeries.ps1

Set-StrictMode -Version 3

<#
.SYNOPSIS
 
Represents a series that renders contours.
 
See wikipedia (http://en.wikipedia.org/wiki/Contour_line) and link (http://www.mathworks.se/help/techdoc/ref/contour.html).
 
.PARAMETER Parent
 
Gets the parent model of the element.
 
.PARAMETER Color
Sets the color.
 
.PARAMETER ActualColor
 
Gets the actual color.
 
.PARAMETER ColumnCoordinates
Sets the column coordinates.
 
.PARAMETER ContourLevelStep
Sets the contour level step size.
This property is not used if the ContourLevels vector is set.
 
.PARAMETER ContourLevels
Sets the contour levels.
 
.PARAMETER ContourColors
Sets the contour colors.
 
These colors will override the Color of the series.
If there are less colors than the number of contour levels, the colors will cycle.
 
.PARAMETER Data
Sets the data.
 
.PARAMETER LabelBackground
Sets the text background color.
 
.PARAMETER LabelFormatString
Sets the format string for contour values.
 
.PARAMETER LabelSpacing
Sets the label spacing.
 
.PARAMETER LabelStep
Sets the label step (number of contours per label).
 
.PARAMETER LineStyle
Sets the line style.
 
.PARAMETER RowCoordinates
Sets the row coordinates.
 
.PARAMETER StrokeThickness
Sets the stroke thickness.
 
.PARAMETER ItemsSource
Sets the items source. The default is null.
 
.PARAMETER Background
Sets the background color of the series. The default is OxyColors.Undefined.
 
This property defines the background color in the area defined by the x and y axes used by this series.
 
.PARAMETER IsVisible
Sets a value indicating whether this series is visible. The default is true.
 
.PARAMETER Title
Sets the title of the series. The default is null.
 
.PARAMETER RenderInLegend
Sets a value indicating whether the series should be rendered in the legend. The default is true.
 
.PARAMETER TrackerFormatString
Sets a format string used for the tracker. The default depends on the series.
 
The arguments for the format string may be different for each type of series. See the documentation.
 
.PARAMETER TrackerKey
Sets the key for the tracker to use on this series. The default is null.
 
This key may be used by the plot view to show a custom tracker for the series.
 
.PARAMETER MaxX
Sets the maximum x-coordinate of the dataset.
 
.PARAMETER MaxY
Sets the maximum y-coordinate of the dataset.
 
.PARAMETER MinX
Sets the minimum x-coordinate of the dataset.
 
.PARAMETER MinY
Sets the minimum y-coordinate of the dataset.
 
.PARAMETER XAxis
 
Gets the x-axis.
 
.PARAMETER XAxisKey
Sets the x-axis key. The default is null.
 
.PARAMETER YAxis
 
Gets the y-axis.
 
.PARAMETER YAxisKey
Sets the y-axis key. The default is null.
 
.PARAMETER IsXMonotonic
Sets a value indicating whether the X coordinate of all data point increases monotonically.
 
.PARAMETER WindowStartIndex
Sets the last visible window start position in the data points collection.
 
.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.
 
.LINK
http://en.wikipedia.org/wiki/Contour_line
 
.LINK
http://www.mathworks.se/help/techdoc/ref/contour.html
 
.PARAMETER Options
Sets properties of the object.
 
.PARAMETER Style
Sets a style of the object.
 
.PARAMETER AddTo
Specifies a plot model to which the object will be added.
 
.INPUTS
You cannot pipe input to the cmdlet.
#>

function New-OxyContourSeries {
  [cmdletbinding()]
  [OutputType([OxyPlot.Series.ContourSeries[]], [void])]
  param(
    [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,
    [double[]]$ColumnCoordinates,
    [double]$ContourLevelStep,
    [double[]]$ContourLevels,
    [OxyPlot.OxyColor[]]$ContourColors,
    [object]$Data,
    [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]$LabelBackground,
    [string]$LabelFormatString,
    [double]$LabelSpacing,
    [int]$LabelStep,
    [OxyPlot.LineStyle]$LineStyle,
    [double[]]$RowCoordinates,
    [double]$StrokeThickness,
    [double]$MaxX,
    [double]$MaxY,
    [double]$MinX,
    [double]$MinY,
    [string]$XAxisKey,
    [string]$YAxisKey,
    [System.Collections.IEnumerable]$ItemsSource,
    [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]$Background,
    [bool]$IsVisible,
    [string]$Title,
    [bool]$RenderInLegend,
    [string]$TrackerFormatString,
    [string]$TrackerKey,
    [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
  )

begin {

  if (!(Test-OxyStyleName $Style)) {
    Write-Error "Unknown style: '$Style'"
    return
  }

  $info = [PSCustomObject]@{
    XAxisTitle = $null
    YAxisTitle = $null
    XDataType = $null
    YDataType = $null
    GroupName = $null
    CategoryNames = @()
    CategoryTitle = $null
  }



}


end {
    $series = New-Object OxyPlot.Series.ContourSeries

    foreach ($key in $Options.Keys) {
      $series.$key = $Options[$key]
    }
    if ($PSBoundParameters.ContainsKey('Color')) { $series.Color = New-OxyColor $Color }
    if ($PSBoundParameters.ContainsKey('ColumnCoordinates')) { $series.ColumnCoordinates = $ColumnCoordinates }
    if ($PSBoundParameters.ContainsKey('ContourLevelStep')) { $series.ContourLevelStep = $ContourLevelStep }
    if ($PSBoundParameters.ContainsKey('ContourLevels')) { $series.ContourLevels = $ContourLevels }
    if ($PSBoundParameters.ContainsKey('ContourColors')) { $series.ContourColors = $ContourColors }
    if ($PSBoundParameters.ContainsKey('Data')) { $series.Data = New-OxyTwoDimensionArray $Data }
    if ($PSBoundParameters.ContainsKey('LabelBackground')) { $series.LabelBackground = New-OxyColor $LabelBackground }
    if ($PSBoundParameters.ContainsKey('LabelFormatString')) { $series.LabelFormatString = $LabelFormatString }
    if ($PSBoundParameters.ContainsKey('LabelSpacing')) { $series.LabelSpacing = $LabelSpacing }
    if ($PSBoundParameters.ContainsKey('LabelStep')) { $series.LabelStep = $LabelStep }
    if ($PSBoundParameters.ContainsKey('LineStyle')) { $series.LineStyle = $LineStyle }
    if ($PSBoundParameters.ContainsKey('RowCoordinates')) { $series.RowCoordinates = $RowCoordinates }
    if ($PSBoundParameters.ContainsKey('StrokeThickness')) { $series.StrokeThickness = $StrokeThickness }
    if ($PSBoundParameters.ContainsKey('MaxX')) { $series.MaxX = $MaxX }
    if ($PSBoundParameters.ContainsKey('MaxY')) { $series.MaxY = $MaxY }
    if ($PSBoundParameters.ContainsKey('MinX')) { $series.MinX = $MinX }
    if ($PSBoundParameters.ContainsKey('MinY')) { $series.MinY = $MinY }
    if ($PSBoundParameters.ContainsKey('XAxisKey')) { $series.XAxisKey = $XAxisKey }
    if ($PSBoundParameters.ContainsKey('YAxisKey')) { $series.YAxisKey = $YAxisKey }
    if ($PSBoundParameters.ContainsKey('ItemsSource')) { $series.ItemsSource = $ItemsSource }
    if ($PSBoundParameters.ContainsKey('Background')) { $series.Background = New-OxyColor $Background }
    if ($PSBoundParameters.ContainsKey('IsVisible')) { $series.IsVisible = $IsVisible }
    if ($PSBoundParameters.ContainsKey('Title')) { $series.Title = $Title }
    if ($PSBoundParameters.ContainsKey('RenderInLegend')) { $series.RenderInLegend = $RenderInLegend }
    if ($PSBoundParameters.ContainsKey('TrackerFormatString')) { $series.TrackerFormatString = $TrackerFormatString }
    if ($PSBoundParameters.ContainsKey('TrackerKey')) { $series.TrackerKey = $TrackerKey }
    if ($PSBoundParameters.ContainsKey('Font')) { $series.Font = $Font }
    if ($PSBoundParameters.ContainsKey('FontSize')) { $series.FontSize = $FontSize }
    if ($PSBoundParameters.ContainsKey('FontWeight')) { $series.FontWeight = $FontWeight }
    if ($PSBoundParameters.ContainsKey('Tag')) { $series.Tag = $Tag }
    if ($PSBoundParameters.ContainsKey('TextColor')) { $series.TextColor = New-OxyColor $TextColor }
    if ($PSBoundParameters.ContainsKey('ToolTip')) { $series.ToolTip = $ToolTip }
    if ($PSBoundParameters.ContainsKey('Selectable')) { $series.Selectable = $Selectable }
    if ($PSBoundParameters.ContainsKey('SelectionMode')) { $series.SelectionMode = $SelectionMode }
    if ($PSBoundParameters.ContainsKey('Parent')) { $series.Parent = $Parent }


    $series = $series | Add-Member -PassThru NoteProperty _Info $info

    Apply-OxyStyle $series $Style $MyInvocation

    if ($AddTo -ne $null) {
      Add-OxyObjectToPlotModel $series $AddTo -NoRefresh
    }
    else {
      $series
    }

  if ($AddTo -ne $null) {
    $AddTo.InvalidatePlot($true)
  }
}
}