diff --git a/CI/03_Build.ps1 b/CI/03_Build.ps1
index 4a39e75b..018c2289 100644
--- a/CI/03_Build.ps1
+++ b/CI/03_Build.ps1
@@ -82,7 +82,8 @@ Write-Host "[BUILD][START][PSD1] Adding functions to export" -ForegroundColor RE
$FunctionsToExport = $PublicFunctions.BaseName
$Manifest = Join-Path -Path $ModuleFolderPath -ChildPath "$($ModuleName).psd1"
-Update-ModuleManifest -Path $Manifest -FunctionsToExport $FunctionsToExport
+$Tags = @( 'PSEdition_Core','PSEdition_Desktop','pshtml','html','web' )
+Update-ModuleManifest -Path $Manifest -FunctionsToExport $FunctionsToExport -Tags $Tags
Write-Host "[BUILD][END][MAIN PSM1] building main PSM1 " -ForegroundColor RED -BackgroundColor White
diff --git a/Code/Classes/003.pshtml.components.charts.ps1 b/Code/Classes/003.pshtml.components.charts.ps1
index 933a34ed..023e3d0a 100644
--- a/Code/Classes/003.pshtml.components.charts.ps1
+++ b/Code/Classes/003.pshtml.components.charts.ps1
@@ -498,6 +498,66 @@ Class datasetbar : dataset {
}
}
+Class datasetRadar : dataset {
+ [String] $xAxisID
+ [String] $yAxisID
+ [string] $backgroundColor
+ [string] $borderColor
+ [int] $borderWidth = 1
+ [String] $borderSkipped
+ [string] $hoverBackgroundColor
+ [string] $hoverBorderColor
+ [int] $hoverBorderWidth
+
+ [String]$pointBackgroundColor = "rgba(0, 0, 0, 0.1)"
+ [String]$pointBorderColor = "rgba(0, 0, 0, 0.1)"
+ [Int[]]$pointBorderWidth = 1
+ [float]$pointRadius = 4
+ [ValidateSet("circle","cross","crossRot","dash","line","rect","rectRounded","rectRot","star","triangle")]
+ $pointStyle = "circle"
+
+ [int[]]$pointRotation
+ [float]$pointHitRadius
+
+ [String] $PointHoverBackgroundColor
+ [String] $pointHoverBorderColor
+ [int] $pointHoverBorderWidth
+ [float] $pointHoverRadius
+
+ datasetRadar(){
+
+ }
+
+ datasetRadar([Array]$Data,[Array]$Label){
+
+ $this.SetLabel($Label)
+ $this.AddData($Data)
+
+ }
+
+ SetPointSettings([float]$pointRadius,[float]$pointHitRadius,[float]$pointHoverRadius,[string]$pointBackgroundColor,[string]$pointBorderColor){
+ Write-Verbose "[DatasetLine][SetPointSettings] Start"
+ $this.pointRadius = $pointRadius
+ $this.pointHitRadius = $pointHitRadius
+ $this.pointHoverRadius = $pointHoverRadius
+ $this.pointBackgroundColor = $pointBackgroundColor
+ $this.pointBorderColor = $pointBorderColor
+ Write-Verbose "[DatasetLine][SetPointSettings] End"
+ }
+
+ [hashtable]GetPointSettings(){
+ Write-Verbose "[DatasetLine][GetPointSettings] Start"
+ return @{
+ PointRadius = $this.pointRadius
+ PointHitRadius = $this.pointHitRadius
+ PointHoverRadius = $this.pointHoverRadius
+ pointBackgroundColor = $this.pointBackgroundColor
+ pointBorderColor = $this.pointBorderColor
+ }
+ Write-Verbose "[DatasetLine][GetPointSettings] End"
+ }
+}
+
Class datasetPolarArea : dataset {
[Array] $backgroundColor
[Array] $borderColor
diff --git a/Code/Functions/Public/New-PSHTMLChartRadarDataSet.ps1 b/Code/Functions/Public/New-PSHTMLChartRadarDataSet.ps1
new file mode 100644
index 00000000..15e908d0
--- /dev/null
+++ b/Code/Functions/Public/New-PSHTMLChartRadarDataSet.ps1
@@ -0,0 +1,134 @@
+function New-PSHTMLChartRadarDataSet {
+ <#
+ .SYNOPSIS
+ Create a dataset object for a Radar chart
+ .DESCRIPTION
+ Use this function to generate a Dataset for a Radar chart.
+ It allows to specify options such as, the label name, Background / border / hover colors etc..
+ .EXAMPLE
+
+ .PARAMETER Data
+ Specify an array of values.
+ ex: @(3,5,42,69)
+ .PARAMETER Label
+ Name of the dataset
+ .PARAMETER xAxisID
+ X axis ID
+ .PARAMETER yAxisID
+ Y axis ID
+ .PARAMETER BackgroundColor
+ The background color of the bar chart values.
+ Use either: [Color] to generate a color,
+ Or specify directly one of the following formats:
+ RGB(120,240,50)
+ RGBA(120,240,50,0.4)
+ .PARAMETER BorderColor
+ The border color of the bar chart values.
+ Use either: [Color] to generate a color,
+ Or specify directly one of the following formats:
+ RGB(120,240,50)
+ RGBA(120,240,50,0.4)
+ .PARAMETER BorderWidth
+ expressed in px's
+ .PARAMETER BorderSkipped
+ border is skipped
+
+ .PARAMETER HoverBorderColor
+ The HoverBorder color of the bar chart values.
+ Use either:
+ [Color] to generate a color,
+ Or specify directly one of the following formats:
+ RGB(120,240,50)
+ RGBA(120,240,50,0.4)
+ .EXAMPLE
+ $Data1 = @(34,7,11,19)
+ $dsb1 = New-PSHTMLChartBarDataSet -Data $data1 -label "March" -BackgroundColor ([Color]::Orange)
+
+ #Dataset containg data from 'March'
+
+ .EXAMPLE
+
+ $Data2 = @(40,2,13,17)
+ $dsb2 = New-PSHTMLChartBarDataSet -Data $data2 -label "April" -BackgroundColor ([Color]::red)
+
+ #DataSet Containg data from 'April'
+
+ .OUTPUTS
+ DataSetBar
+ .NOTES
+ Made with love by Stephanevg
+ .LINK
+ https://github.com/Stephanevg/PSHTML
+ #>
+ [CmdletBinding()]
+ [OutputType([datasetBar])]
+ param (
+ [Array]$Data,
+ [String]$label,
+ [String] $xAxisID,
+ [String] $yAxisID,
+ [string] $backgroundColor,
+ [string] $borderColor,
+ [int] $borderWidth = 1,
+ [String] $borderSkipped,
+ [string] $hoverBackgroundColor,
+ [string] $hoverBorderColor,
+ [int] $hoverBorderWidth,
+ [float]$PointRadius = 4,
+ [float]$PointHitRadius = 0,
+ [float]$PointHoverRadius = 0,
+ [String]$pointBackgroundColor = "rgba(0, 0, 0, 0.1)",
+ [String]$pointBorderColor = "rgba(0, 0, 0, 0.1)"
+ )
+
+ $Datachart = [datasetRadar]::New()
+
+ if($Data){
+ $null = $Datachart.AddData($Data)
+ }
+
+ If($Label){
+ $Datachart.label = $label
+ }
+
+ if($xAxisID){
+ $Datachart.xAxisID = $xAxisID
+ }
+
+ if($yAxisID){
+ $Datachart.yAxisID = $yAxisID
+ }
+
+ if($backgroundColor){
+ $Datachart.backgroundColor = $backgroundColor
+ }
+
+ If($borderColor){
+ $Datachart.borderColor = $borderColor
+ }
+ else {
+ $Datachart.borderColor = ''
+ }
+ if ($borderWidth){
+ $Datachart.borderWidth = $borderWidth
+ }
+
+ if($borderSkipped){
+ $Datachart.borderSkipped = $borderSkipped
+ }
+
+ If($hoverBackgroundColor){
+ $Datachart.hoverBackgroundColor = $hoverBackgroundColor
+ }
+
+ If($HoverBorderColor){
+ $Datachart.hoverBorderColor = $HoverBorderColor
+ }
+ if($HoverBorderWidth){
+ $Datachart.HoverBorderWidth = $HoverBorderWidth
+ }
+
+ $Datachart.SetPointSettings($PointRadius,$PointHitRadius,$PointHoverRadius,$pointBackgroundColor,$pointBorderColor)
+
+ return $Datachart
+}
\ No newline at end of file
diff --git a/PSHTML/Examples/Charts/Chart09/RadarChart.html b/PSHTML/Examples/Charts/Chart09/RadarChart.html
index 0796e4c5..87478922 100644
--- a/PSHTML/Examples/Charts/Chart09/RadarChart.html
+++ b/PSHTML/Examples/Charts/Chart09/RadarChart.html
@@ -1 +1,16 @@
-
Chart JS DemonstrationPSHTML Graph
+
+
+
+ Chart JS Demonstration
+
+
+
+ PSHTML Graph
+
+
This is a radar graph
+
+
+
+
+
+
\ No newline at end of file
diff --git a/PSHTML/Examples/Charts/Chart09/RadarChart.ps1 b/PSHTML/Examples/Charts/Chart09/RadarChart.ps1
index aff57956..e7c19e4b 100644
--- a/PSHTML/Examples/Charts/Chart09/RadarChart.ps1
+++ b/PSHTML/Examples/Charts/Chart09/RadarChart.ps1
@@ -30,9 +30,9 @@ $HTMLDocument = html {
$dsb1 = @()
$Data1 = @(17,25,18,17,22,30,35,44,4,1,6,12)
- $dsb1 += New-PSHTMLChartBarDataSet -Data $data1 -label "2018" -borderColor (get-pshtmlColor -color blue) -backgroundColor "transparent" -hoverBackgroundColor (get-pshtmlColor -color green)
+ $dsb1 += New-PSHTMLChartRadarDataSet -Data $data1 -label "2018" -borderColor (get-pshtmlColor -color blue) -backgroundColor "transparent" -hoverBackgroundColor (get-pshtmlColor -color green) -PointRadius 2
$Data2 = @(4,1,6,12,17,25,18,17,22,30,35,44)
- $dsb1 += New-PSHTMLChartBarDataSet -Data $data2 -label "2019" -borderColor (get-pshtmlColor -color red) -backgroundColor "transparent" -hoverBackgroundColor (get-pshtmlColor -color yellow)
+ $dsb1 += New-PSHTMLChartRadarDataSet -Data $data2 -label "2019" -borderColor (get-pshtmlColor -color red) -backgroundColor "transparent" -hoverBackgroundColor (get-pshtmlColor -color yellow) -PointRadius 10 -pointBackgroundColor (get-pshtmlColor -color red) -pointBorderColor (get-pshtmlColor -color blue)
New-PSHTMLChart -type radar -DataSet $dsb1 -title "Radar Chart Example" -Labels $Labels -CanvasID $radarCanvasID
diff --git a/PSHTML/Examples/Charts/Chart10/PolarAreaChart.ps1 b/PSHTML/Examples/Charts/Chart10/PolarAreaChart.ps1
index a913229a..763fc264 100644
--- a/PSHTML/Examples/Charts/Chart10/PolarAreaChart.ps1
+++ b/PSHTML/Examples/Charts/Chart10/PolarAreaChart.ps1
@@ -17,7 +17,7 @@ $HTMLDocument = html {
p {
"This is a polarArea graph"
}
- canvas -Height 400px -Width 400px -Id $BarCanvasID {
+ canvas -Height 400px -Width 400px -Id $PolarCanvasID {
}
@@ -32,9 +32,9 @@ $HTMLDocument = html {
$HoverColors = @('DarkGreen', 'yellow', 'Orange', 'grey', 'DarkGrey', 'blue', 'Magenta', 'DarkMagenta', 'red', 'Cyan', 'DarkCyan', 'green' )
$Data1 = @(17, 25, 18, 17, 10, 28, 35, 50, 44, 10, 32, 72)
- $dsb1 = New-PSHTMLChartPolarAreaDataSet -Data $data1 -BackgroundColor $Colors -hoverBackgroundColor $HoverColors
+ $dsb1 = New-PSHTMLChartPolarAreaDataSet -Data $data1 -BackgroundColor $Colors -hoverBackgroundColor $HoverColors -PointRadius
- New-PSHTMLChart -type polarArea -DataSet $dsb1 -title 'PolarArea Chart Example' -Labels $Labels -CanvasID $BarCanvasID
+ New-PSHTMLChart -type polarArea -DataSet $dsb1 -title 'PolarArea Chart Example' -Labels $Labels -CanvasID $PolarCanvasID
}
}
}
diff --git a/PSHTML/PSHTML.psd1 b/PSHTML/PSHTML.psd1
index a4ce245c..ec522f30 100644
--- a/PSHTML/PSHTML.psd1
+++ b/PSHTML/PSHTML.psd1
@@ -1,9 +1,9 @@
#
-# Module manifest for module 'PSGet_PSHTML'
+# Module manifest for module 'PSHTML'
#
# Generated by: Stéphane van Gulick
#
-# Generated on: 9/19/2019
+# Generated on: 16.10.2019
#
@{
@@ -32,13 +32,13 @@ Copyright = '(c) 2018 Stéphane van Gulick. All rights reserved.'
# Description of the functionality provided by this module
Description = 'Cross platform PowerShell module to generate HTML markup language and create awesome web pages!'
-# Minimum version of the Windows PowerShell engine required by this module
+# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '5.0'
-# Name of the Windows PowerShell host required by this module
+# Name of the PowerShell host required by this module
# PowerShellHostName = ''
-# Minimum version of the Windows PowerShell host required by this module
+# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
@@ -81,12 +81,12 @@ FunctionsToExport = 'a', 'address', 'area', 'article', 'aside', 'b', 'base', 'bl
'New-PSHTMLChartBarDataSet', 'New-PSHTMLChartDataSet',
'New-PSHTMLChartDoughnutDataSet', 'New-PSHTMLChartLineDataSet',
'New-PSHTMLChartPieDataSet', 'New-PSHTMLChartPolarAreaDataSet',
- 'New-PSHTMLDropDownList', 'New-PSHTMLDropDownListItem',
- 'New-PSHTMLMenu', 'noscript', 'ol', 'optgroup', 'option',
- 'Out-PSHTMLDocument', 'output', 'p', 'pre', 'progress', 'script', 'section',
- 'selecttag', 'small', 'span', 'strong', 'style', 'sub', 'sup', 'table', 'tbody',
- 'td', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'ul',
- 'Write-PSHTMLAsset', 'Write-PSHTMLInclude', 'Write-PSHTMLSymbol'
+ 'New-PSHTMLChartRadarDataSet', 'New-PSHTMLDropDownList',
+ 'New-PSHTMLDropDownListItem', 'New-PSHTMLMenu', 'noscript', 'ol',
+ 'optgroup', 'option', 'Out-PSHTMLDocument', 'output', 'p', 'pre', 'progress',
+ 'script', 'section', 'selecttag', 'small', 'span', 'strong', 'style', 'sub',
+ 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr',
+ 'ul', 'Write-PSHTMLAsset', 'Write-PSHTMLInclude', 'Write-PSHTMLSymbol'
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
@@ -112,7 +112,7 @@ PrivateData = @{
PSData = @{
# Tags applied to this module. These help with module discovery in online galleries.
- Tags = 'pshtml','html','web'
+ Tags = 'PSEdition_Core','PSEdition_Desktop','pshtml','html','web'
# A URL to the license for this module.
# LicenseUri = ''
@@ -129,7 +129,7 @@ PrivateData = @{
# Prerelease string of this module
Prerelease = 'alpha'
- # Flag to indicate whether the module requires explicit user acceptance for install/update
+ # Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false
# External dependent modules of this module
diff --git a/PSHTML/PSHTML.psm1 b/PSHTML/PSHTML.psm1
index 943a464d..81adcdaf 100644
--- a/PSHTML/PSHTML.psm1
+++ b/PSHTML/PSHTML.psm1
@@ -1,4 +1,4 @@
-#Generated at 09/19/2019 19:01:41 by Stephane van Gulick
+#Generated at 10/16/2019 09:11:33 by Stephane van Gulick
Enum SettingType {
General
@@ -735,7 +735,7 @@ Class LogFile : LogDocument {
}
}else{
- $cp = (Get-PSCallStack)[-1].ScriptName #$PSCommandPath #Split-Path -parent $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(�.\�) #$PSCommandPath
+ $cp = (Get-PSCallStack)[-1].ScriptName #$PSCommandPath #Split-Path -parent $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(�.\�) #$PSCommandPath
}
$cp = $global:MyInvocation.MyCommand.Definition #fix for Ubuntu appveyor machines.
@@ -798,7 +798,7 @@ Class LogFile : LogDocument {
}
hidden [string] CreateFileName() {
- $cp = $PSCommandPath #Split-Path -parent $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(�.\�) #$PSCommandPath
+ $cp = $PSCommandPath #Split-Path -parent $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(�.\�) #$PSCommandPath
if(!($cp)){
$cp = (Get-PSCallStack)[-1].ScriptName
}
@@ -1411,6 +1411,66 @@ Class datasetbar : dataset {
}
}
+Class datasetRadar : dataset {
+ [String] $xAxisID
+ [String] $yAxisID
+ [string] $backgroundColor
+ [string] $borderColor
+ [int] $borderWidth = 1
+ [String] $borderSkipped
+ [string] $hoverBackgroundColor
+ [string] $hoverBorderColor
+ [int] $hoverBorderWidth
+
+ [String]$pointBackgroundColor = "rgba(0, 0, 0, 0.1)"
+ [String]$pointBorderColor = "rgba(0, 0, 0, 0.1)"
+ [Int[]]$pointBorderWidth = 1
+ [float]$pointRadius = 4
+ [ValidateSet("circle","cross","crossRot","dash","line","rect","rectRounded","rectRot","star","triangle")]
+ $pointStyle = "circle"
+
+ [int[]]$pointRotation
+ [float]$pointHitRadius
+
+ [String] $PointHoverBackgroundColor
+ [String] $pointHoverBorderColor
+ [int] $pointHoverBorderWidth
+ [float] $pointHoverRadius
+
+ datasetRadar(){
+
+ }
+
+ datasetRadar([Array]$Data,[Array]$Label){
+
+ $this.SetLabel($Label)
+ $this.AddData($Data)
+
+ }
+
+ SetPointSettings([float]$pointRadius,[float]$pointHitRadius,[float]$pointHoverRadius,[string]$pointBackgroundColor,[string]$pointBorderColor){
+ Write-Verbose "[DatasetLine][SetPointSettings] Start"
+ $this.pointRadius = $pointRadius
+ $this.pointHitRadius = $pointHitRadius
+ $this.pointHoverRadius = $pointHoverRadius
+ $this.pointBackgroundColor = $pointBackgroundColor
+ $this.pointBorderColor = $pointBorderColor
+ Write-Verbose "[DatasetLine][SetPointSettings] End"
+ }
+
+ [hashtable]GetPointSettings(){
+ Write-Verbose "[DatasetLine][GetPointSettings] Start"
+ return @{
+ PointRadius = $this.pointRadius
+ PointHitRadius = $this.pointHitRadius
+ PointHoverRadius = $this.pointHoverRadius
+ pointBackgroundColor = $this.pointBackgroundColor
+ pointBorderColor = $this.pointBorderColor
+ }
+ Write-Verbose "[DatasetLine][GetPointSettings] End"
+ }
+}
+
Class datasetPolarArea : dataset {
[Array] $backgroundColor
[Array] $borderColor
@@ -2927,7 +2987,7 @@ Function base {
base "woop1" -Class "class"
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Current Version: 3.1
History:
2018.11.1; Stephanevg;Updated to version 3.1
@@ -3169,7 +3229,7 @@ Function button {
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1
History:
2018.11.1; Stephanevg;Updated to version 3.1
@@ -4209,7 +4269,7 @@ Function fieldset {
fieldset {$css} -media "print" -type "text/css"
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -4678,7 +4738,7 @@ function Get-PSHTMLAsset {
.OUTPUTS
Asset[]
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
.Link
https://github.com/Stephanevg/PSHTML
#>
@@ -4929,7 +4989,7 @@ Function H1 {
h1 {"woop3"} -Class "class" -Id "MaintTitle" -Style "color:red;"
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -4983,7 +5043,7 @@ Function h2 {
h2 {"woop3"} -Class "class" -Id "MaintTitle" -Style "color:red;"
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -5035,7 +5095,7 @@ Function h3 {
h3 {"woop3"} -Class "class" -Id "MaintTitle" -Style "color:red;"
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -5087,7 +5147,7 @@ Function h4 {
h4 {"woop3"} -Class "class" -Id "MaintTitle" -Style "color:red;"
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -5139,7 +5199,7 @@ Function h5 {
h5 {"woop3"} -Class "class" -Id "MaintTitle" -Style "color:red;"
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -5191,7 +5251,7 @@ Function h6 {
h6 {"woop3"} -Class "class" -Id "MaintTitle" -Style "color:red;"
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -5419,7 +5479,7 @@ Function hr {
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 2.0.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -5882,7 +5942,7 @@ Function label {
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 1.0.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -5938,7 +5998,7 @@ Function legend {
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -6085,7 +6145,7 @@ Function Link {
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -6324,7 +6384,7 @@ Function meta {
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -6516,7 +6576,7 @@ Function nav {
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -7020,7 +7080,7 @@ Function New-PSHTMLChartDataSet {
.OUTPUTS
[DataSet]
.NOTES
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
#>
[CmdletBInding()]
Param(
@@ -7524,6 +7584,140 @@ function New-PSHTMLChartPolarAreaDataSet {
return $Datachart
}
+function New-PSHTMLChartRadarDataSet {
+ <#
+ .SYNOPSIS
+ Create a dataset object for a Radar chart
+ .DESCRIPTION
+ Use this function to generate a Dataset for a Radar chart.
+ It allows to specify options such as, the label name, Background / border / hover colors etc..
+ .EXAMPLE
+
+ .PARAMETER Data
+ Specify an array of values.
+ ex: @(3,5,42,69)
+ .PARAMETER Label
+ Name of the dataset
+ .PARAMETER xAxisID
+ X axis ID
+ .PARAMETER yAxisID
+ Y axis ID
+ .PARAMETER BackgroundColor
+ The background color of the bar chart values.
+ Use either: [Color] to generate a color,
+ Or specify directly one of the following formats:
+ RGB(120,240,50)
+ RGBA(120,240,50,0.4)
+ .PARAMETER BorderColor
+ The border color of the bar chart values.
+ Use either: [Color] to generate a color,
+ Or specify directly one of the following formats:
+ RGB(120,240,50)
+ RGBA(120,240,50,0.4)
+ .PARAMETER BorderWidth
+ expressed in px's
+ .PARAMETER BorderSkipped
+ border is skipped
+
+ .PARAMETER HoverBorderColor
+ The HoverBorder color of the bar chart values.
+ Use either:
+ [Color] to generate a color,
+ Or specify directly one of the following formats:
+ RGB(120,240,50)
+ RGBA(120,240,50,0.4)
+ .EXAMPLE
+ $Data1 = @(34,7,11,19)
+ $dsb1 = New-PSHTMLChartBarDataSet -Data $data1 -label "March" -BackgroundColor ([Color]::Orange)
+
+ #Dataset containg data from 'March'
+
+ .EXAMPLE
+
+ $Data2 = @(40,2,13,17)
+ $dsb2 = New-PSHTMLChartBarDataSet -Data $data2 -label "April" -BackgroundColor ([Color]::red)
+
+ #DataSet Containg data from 'April'
+
+ .OUTPUTS
+ DataSetBar
+ .NOTES
+ Made with love by Stephanevg
+ .LINK
+ https://github.com/Stephanevg/PSHTML
+ #>
+ [CmdletBinding()]
+ [OutputType([datasetBar])]
+ param (
+ [Array]$Data,
+ [String]$label,
+ [String] $xAxisID,
+ [String] $yAxisID,
+ [string] $backgroundColor,
+ [string] $borderColor,
+ [int] $borderWidth = 1,
+ [String] $borderSkipped,
+ [string] $hoverBackgroundColor,
+ [string] $hoverBorderColor,
+ [int] $hoverBorderWidth,
+ [float]$PointRadius = 4,
+ [float]$PointHitRadius = 0,
+ [float]$PointHoverRadius = 0,
+ [String]$pointBackgroundColor = "rgba(0, 0, 0, 0.1)",
+ [String]$pointBorderColor = "rgba(0, 0, 0, 0.1)"
+ )
+
+ $Datachart = [datasetRadar]::New()
+
+ if($Data){
+ $null = $Datachart.AddData($Data)
+ }
+
+ If($Label){
+ $Datachart.label = $label
+ }
+
+ if($xAxisID){
+ $Datachart.xAxisID = $xAxisID
+ }
+
+ if($yAxisID){
+ $Datachart.yAxisID = $yAxisID
+ }
+
+ if($backgroundColor){
+ $Datachart.backgroundColor = $backgroundColor
+ }
+
+ If($borderColor){
+ $Datachart.borderColor = $borderColor
+ }
+ else {
+ $Datachart.borderColor = ''
+ }
+ if ($borderWidth){
+ $Datachart.borderWidth = $borderWidth
+ }
+
+ if($borderSkipped){
+ $Datachart.borderSkipped = $borderSkipped
+ }
+
+ If($hoverBackgroundColor){
+ $Datachart.hoverBackgroundColor = $hoverBackgroundColor
+ }
+
+ If($HoverBorderColor){
+ $Datachart.hoverBorderColor = $HoverBorderColor
+ }
+ if($HoverBorderWidth){
+ $Datachart.HoverBorderWidth = $HoverBorderWidth
+ }
+
+ $Datachart.SetPointSettings($PointRadius,$PointHitRadius,$PointHoverRadius,$pointBackgroundColor,$pointBorderColor)
+
+ return $Datachart
+}
function New-PSHTMLDropDownList {
<#
.SYNOPSIS
@@ -7939,7 +8133,7 @@ Function optgroup {
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -8072,7 +8266,7 @@ function Out-PSHTMLDocument {
.DESCRIPTION
Output the html string into a file.
.EXAMPLE
- The following example gets the list of first 5 processes. Converts it into an HTML Table. It outputs the results in a file, and opens the results imédiatley.
+ The following example gets the list of first 5 processes. Converts it into an HTML Table. It outputs the results in a file, and opens the results imédiatley.
$o = Get-PRocess | select ProcessName,Handles | select -first 5
$FilePath = "C:\temp\OutputFile.html"
@@ -8085,7 +8279,7 @@ function Out-PSHTMLDocument {
None
.NOTES
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
.LINK
@@ -8578,7 +8772,7 @@ Function selecttag {
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.2.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -8638,7 +8832,7 @@ Function small {
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -8753,7 +8947,7 @@ Function strong {
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
@@ -8812,7 +9006,7 @@ Function style {
style {$css} -media "print" -type "text/css"
.Notes
- Author: Stéphane van Gulick
+ Author: Stéphane van Gulick
Version: 3.1.0
History:
2018.10.30;@ChristopheKumor;Updated to version 3.0
diff --git a/Tests/Chart.New-PSHTMLChart.Tests.ps1 b/Tests/Chart.New-PSHTMLChart.Tests.ps1
index bc46ab9b..192b2e39 100644
--- a/Tests/Chart.New-PSHTMLChart.Tests.ps1
+++ b/Tests/Chart.New-PSHTMLChart.Tests.ps1
@@ -164,14 +164,10 @@ var ctx = document.getElementById("TestCanvasID").getContext('2d'); var myChart
$Labels = @("january", "february")
- $Data = @(3, 5)
$Title = "Test Title"
$CanvasID = "TestCanvasID"
- #$bds =
- <# mock -CommandName New-PSHTMLChartBarDataSet -MockWith {
- New-MockObject -Type "datasetbar"
- } #>
- $bds = New-PSHTMLChartBarDataSet -Data $Data
+ $Data1 = @(17,25,18,17,22,30,35,44,4,1,6,12)
+ $bds = New-PSHTMLChartRadarDataSet -Data $data1 -label "2018" -borderColor (get-pshtmlColor -color blue) -backgroundColor "transparent" -hoverBackgroundColor (get-pshtmlColor -color green) -PointRadius 2
it '[New-PSHTMLChart][-Type Radar][-DataSet BarDataSet][Label][Title][CanvasId] Should not throw' {
{New-PSHTMLChart -Type Radar -DataSet $bds -Labels $Labels -Title $Title -CanvasID $CanvasID} | should not throw
@@ -179,19 +175,18 @@ var ctx = document.getElementById("TestCanvasID").getContext('2d'); var myChart
it '[New-PSHTMLChart][-Type Radar][-DataSet BarDataSet][Label][Title][CanvasId] Should create ChartJS javascript Code' {
$Is = New-PSHTMLChart -Type radar -DataSet $bds -Labels $Labels -Title $Title -CanvasID $CanvasID
-<#
-$Should = @'
-
+ If($PSVersionTable.PsEdition -eq 'Core'){
+ $Should = @'
+var ctx = document.getElementById("TestCanvasID").getContext('2d'); var myChart = new Chart(ctx, {"type":"radar","data":{"labels":["january","february"],"datasets":[{"borderWidth":1,"pointBackgroundColor":"rgba(0, 0, 0, 0.1)","pointBorderColor":"rgba(0, 0, 0, 0.1)","pointBorderWidth":[1],"pointRadius":2.0,"pointStyle":"circle","xAxisID":null,"yAxisID":null,"backgroundColor":"transparent","borderColor":"rgb(0,0,255)","borderSkipped":null,"hoverBackgroundColor":"rgb(0,128,0)","hoverBorderColor":null,"hoverBorderWidth":0,"pointRotation":null,"pointHitRadius":0.0,"PointHoverBackgroundColor":null,"pointHoverBorderColor":null,"pointHoverBorderWidth":0,"pointHoverRadius":0.0,"data":[17,25,18,17,22,30,35,44,4,1,6,12],"label":["2018"]}]},"options":{"scales":null,"barPercentage":1,"categoryPercentage":1,"responsive":false,"barThickness":null,"maxBarThickness":0,"offsetGridLines":true,"title":{"display":true,"text":"Test Title"},"animation":{"onComplete":null}}} );
'@
-#>
-
-$Should = @'
-var ctx = document.getElementById("TestCanvasID").getContext('2d'); var myChart = new Chart(ctx, {"type":"radar","data":{"labels":["january","february"],"datasets":[{"borderWidth":1,"xAxisID":null,"yAxisID":null,"backgroundColor":null,"borderColor":"","borderSkipped":null,"hoverBackgroundColor":null,"hoverBorderColor":null,"hoverBorderWidth":0,"data":[3,5],"label":null}]},"options":{"scales":null,"barPercentage":1,"categoryPercentage":1,"responsive":false,"barThickness":null,"maxBarThickness":0,"offsetGridLines":true,"title":{"display":true,"text":"Test Title"},"animation":{"onComplete":null}}} );
+ }
+ else {
+ $Should = @'
+var ctx = document.getElementById("TestCanvasID").getContext('2d'); var myChart = new Chart(ctx, {"type":"radar","data":{"labels":["january","february"],"datasets":[{"borderWidth":1,"pointBackgroundColor":"rgba(0, 0, 0, 0.1)","pointBorderColor":"rgba(0, 0, 0, 0.1)","pointBorderWidth":[1],"pointRadius":2,"pointStyle":"circle","xAxisID":null,"yAxisID":null,"backgroundColor":"transparent","borderColor":"rgb(0,0,255)","borderSkipped":null,"hoverBackgroundColor":"rgb(0,128,0)","hoverBorderColor":null,"hoverBorderWidth":0,"pointRotation":null,"pointHitRadius":0,"PointHoverBackgroundColor":null,"pointHoverBorderColor":null,"pointHoverBorderWidth":0,"pointHoverRadius":0,"data":[17,25,18,17,22,30,35,44,4,1,6,12],"label":["2018"]}]},"options":{"scales":null,"barPercentage":1,"categoryPercentage":1,"responsive":false,"barThickness":null,"maxBarThickness":0,"offsetGridLines":true,"title":{"display":true,"text":"Test Title"},"animation":{"onComplete":null}}} );
'@
+ }
- #$Is | should be $Should
-
$Is | should be $Should
}