Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CI/03_Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
60 changes: 60 additions & 0 deletions Code/Classes/003.pshtml.components.charts.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
134 changes: 134 additions & 0 deletions Code/Functions/Public/New-PSHTMLChartRadarDataSet.ps1
Original file line number Diff line number Diff line change
@@ -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
}
17 changes: 16 additions & 1 deletion PSHTML/Examples/Charts/Chart09/RadarChart.html
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
<html ><head ><title >Chart JS Demonstration</title></head><Body ><h1 >PSHTML Graph</h1><div ><p >This is a radar graph</p><canvas Width="400px" Id="barcanvas" Height="400px" ></canvas></div><script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js" type="text/javascript" ></script><script >var ctx = document.getElementById("barcanvas").getContext('2d'); var myChart = new Chart(ctx, {"type":"radar","data":{"labels":["January","February","Mars","April","Mai","June","July","August","September","October","November","december"],"datasets":[{"borderWidth":1,"xAxisID":null,"yAxisID":null,"backgroundColor":"transparent","borderColor":"rgb(30,144,255)","borderSkipped":null,"hoverBackgroundColor":"rgb(173,255,47)","hoverBorderColor":null,"hoverBorderWidth":0,"data":[17,25,18,17,22,30,35,44,4,1,6,12],"label":["2018"]},{"borderWidth":1,"xAxisID":null,"yAxisID":null,"backgroundColor":"transparent","borderColor":"rgb(220,20,60)","borderSkipped":null,"hoverBackgroundColor":"rgb(255,255,0)","hoverBorderColor":null,"hoverBorderWidth":0,"data":[4,1,6,12,17,25,18,17,22,30,35,44],"label":["2019"]}]},"options":{"scales":null,"barPercentage":1,"categoryPercentage":1,"responsive":false,"barThickness":null,"maxBarThickness":0,"offsetGridLines":true,"title":{"display":true,"text":"Radar Chart Example"}}} );</script></Body></html>
<html>

<head>
<title>Chart JS Demonstration</title>
</head>

<Body>
<h1>PSHTML Graph</h1>
<div>
<p>This is a radar graph</p><canvas Width="400px" Id="barcanvas" Height="400px"></canvas>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js" type="text/javascript"></script>
<script>var ctx = document.getElementById("barcanvas").getContext('2d'); var myChart = new Chart(ctx, { "type": "radar", "data": { "labels": ["January", "February", "Mars", "April", "Mai", "June", "July", "August", "September", "October", "November", "december"], "datasets": [{ "borderWidth": 1, "xAxisID": null, "yAxisID": null, "backgroundColor": "transparent", "borderColor": "rgb(30,144,255)", "borderSkipped": null, "hoverBackgroundColor": "rgb(173,255,47)", "hoverBorderColor": null, "hoverBorderWidth": 0, "data": [17, 25, 18, 17, 22, 30, 35, 44, 4, 1, 6, 12], "label": ["2018"] }, { "borderWidth": 1, "xAxisID": null, "yAxisID": null, "backgroundColor": "transparent", "borderColor": "rgb(220,20,60)", "borderSkipped": null, "hoverBackgroundColor": "rgb(255,255,0)", "hoverBorderColor": null, "hoverBorderWidth": 0, "data": [4, 1, 6, 12, 17, 25, 18, 17, 22, 30, 35, 44], "label": ["2019"] }] }, "options": { "scales": null, "barPercentage": 1, "categoryPercentage": 1, "responsive": false, "barThickness": null, "maxBarThickness": 0, "offsetGridLines": true, "title": { "display": true, "text": "Radar Chart Example" } } });</script>
</Body>

</html>
4 changes: 2 additions & 2 deletions PSHTML/Examples/Charts/Chart09/RadarChart.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions PSHTML/Examples/Charts/Chart10/PolarAreaChart.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

}

Expand All @@ -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
}
}
}
Expand Down
26 changes: 13 additions & 13 deletions PSHTML/PSHTML.psd1
Original file line number Diff line number Diff line change
@@ -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
#

@{
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 = @()
Expand All @@ -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 = ''
Expand All @@ -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
Expand Down
Loading