-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathGet-ScatterPlot.ps1
More file actions
38 lines (31 loc) · 1.21 KB
/
Get-ScatterPlot.ps1
File metadata and controls
38 lines (31 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Function Get-ScatterPlot {
[cmdletbinding()]
[alias("scatter")]
Param(
# Parameter help description
[Parameter(Mandatory=$true)]
[int[]] $Datapoints,
[int] $StartOfRange,
[int] $EndofRange,
[int] $Step = 10
#[ValidateSet("square","dot","triangle")] [String] $Marker = 'dot'
)
# Create a 2D Array to save datapoints in a 2D format
$Difference = $EndofRange - $StartOfRange
$NumOfRows = $difference/($Step) + 1
$NumOfDatapoints = $Datapoints.Count
$Array = New-Object -TypeName 'object[,]' -ArgumentList ($NumOfRows),$NumOfDatapoints
For($i = 0;$i -lt $Datapoints.count;$i++){
# Fit datapoint in a row, where, a row's data range = Total Datapoints / Step
$RowIndex = [Math]::Ceiling($($Datapoints[$i]-$StartOfRange)/$Step)
# use a half marker is datapoint falls in less than equals half of the step
$LowerHalf = $Datapoints[$i]%$Step -in $(1..$HalfStep)
if($LowerHalf){
$Array[$RowIndex,$i] = [char] 9604
}else{
$Array[$RowIndex,$i] = [char] 9600
}
}
# return the 2D array of plots
return ,$Array
}