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
45 changes: 15 additions & 30 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish PowerShell Module

on:
release:
types: [ published ]
types: [published]

jobs:
publish-to-psgallery:
Expand All @@ -23,12 +23,14 @@ jobs:
- name: Build the library for MacOS Arm64
run: dotnet publish ./Sources -c Release -r osx-arm64
- name: Copy the library for MacOS Arm64
run: copy ./Sources/bin/Release/netstandard2.0/osx-arm64/publish/*.*
run:
copy ./Sources/bin/Release/netstandard2.0/osx-arm64/publish/*.*
./AsBuiltReport.Chart/Src/Assemblies/Core/mac-osx/osx-arm64
- name: Build the library for Linux
run: dotnet publish ./Sources -c Release -r linux-x64
- name: Copy the library for Linux
run: copy ./Sources/bin/Release/netstandard2.0/linux-x64/publish/*.*
run:
copy ./Sources/bin/Release/netstandard2.0/linux-x64/publish/*.*
./AsBuiltReport.Chart/Src/Assemblies/Core/linux-x64
- name: Build the library for Windows
run: dotnet publish ./Sources -c Release -r win-x64
Expand All @@ -54,30 +56,13 @@ jobs:
shell: pwsh
run: |
Publish-Module -Path .\AsBuiltReport.Chart\ -NuGetApiKey ${{ secrets.PSGALLERY_API_KEY }} -Verbose
# tweet:
# needs: publish-to-psgallery
# runs-on: ubuntu-latest
# steps:
# - uses: Eomm/why-don-t-you-tweet@v2
# # We don't want to tweet if the repository is not a public one
# if: ${{ !github.event.repository.private }}
# with:
# # GitHub event payload
# # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release
# tweet-message: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #AsBuiltReport #PowerShell"
# env:
# TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
# TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
# TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
# TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
# bsky-post:
# needs: publish-to-psgallery
# runs-on: ubuntu-latest
# steps:
# - uses: zentered/bluesky-post-action@v0.3.0
# with:
# post: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #AsBuiltReport #PowerShell"
# env:
# BSKY_IDENTIFIER: ${{ secrets.BSKY_IDENTIFIER }}
# BSKY_PASSWORD: ${{ secrets.BSKY_PASSWORD }}

bsky-post:
needs: publish-to-psgallery
runs-on: ubuntu-latest
steps:
- uses: zentered/bluesky-post-action@v0.4.0
with:
post: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #AsBuiltReport #PowerShell"
env:
BSKY_IDENTIFIER: ${{ secrets.BSKY_IDENTIFIER }}
BSKY_PASSWORD: ${{ secrets.BSKY_PASSWORD }}
4 changes: 2 additions & 2 deletions AsBuiltReport.Chart/AsBuiltReport.Chart.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'AsBuiltReport.Chart.psm1'

# Version number of this module.
ModuleVersion = '0.3.2'
ModuleVersion = '0.3.3'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -69,7 +69,7 @@
# NestedModules = @()

# Functions 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 functions to export.
FunctionsToExport = 'New-PieChart', 'New-BarChart', 'New-StackedBarChart', 'New-SignalChart', 'New-SingleStackedBarChart'
FunctionsToExport = 'New-PieChart', 'New-BarChart', 'New-StackedBarChart', 'New-SignalChart', 'New-SingleStackedBarChart', 'New-DonutChart', 'New-RadarChart'

# 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 Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.3] - Unreleased

### Added

- Add support for Donut from Slices chart: [Donut from Slices](https://scottplot.net/cookbook/5/Pie/PieDonut/)
- Add pester test to validate the functionality of the New-DonutChart cmdlet
- Add example 12/13 to document on how to use the New-DonutChart cmdlet
- Add radar chart support: implement New-RadarChart cmdlet and associated classes

### Changed

- Update module v0.3.3
- Update SkiaSharp .NET dependency to v3.119.4
- Update HarfBuzzSharp .NET dependency to v8.3.1.5

## [0.3.2] - 2026-05-05

### Added
Expand Down
61 changes: 61 additions & 0 deletions Examples/Example12.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<#
.SYNOPSIS
Example 01 - Basic Donut Chart

.DESCRIPTION
This example demonstrates how to create a basic Donut Chart using the AsBuiltReport.Chart module.
The chart displays a simple breakdown of VM power states across a vSphere environment.
#>

[CmdletBinding()]
param (
[System.IO.DirectoryInfo] $Path = (Get-Location).Path,
[string] $Format = 'png'
)

<#
Starting with PowerShell v3, modules are auto-imported when needed. Importing the module here
ensures clarity and avoids ambiguity.
#>

# Import-Module AsBuiltReport.Chart -Force -Verbose:$false

<#
Since the chart output is a file, specify the output folder path using $OutputFolderPath.
#>

$OutputFolderPath = Resolve-Path $Path

<#
Define the data to be displayed in the chart.
In a real-world scenario these values would come from your infrastructure query.
#>

$ChartTitle = 'User Type Breakdown'
$Values = @(800, 80, 200)
$Labels = @('Members', 'Guests', 'Disabled')

<#
The New-DonutChart cmdlet generates the Donut Chart image.

-Title : Sets the chart title displayed at the top of the image.
-Values : Array of numeric values, one per slice.
-Labels : Array of label strings corresponding to each value.
-Format : Output file format (e.g. png, jpg, svg).
-OutputFolderPath : Directory where the generated chart file will be saved.
-Width : Width of the chart image in pixels.
-Height : Height of the chart image in pixels.
-ColorPalette : Predefined color palette (e.g. Category20, Pastel).
-Filename : Name of the output file (without extension).
#>

New-DonutChart `
-Title $ChartTitle `
-Values $Values `
-Labels $Labels `
-Format $Format `
-OutputFolderPath $OutputFolderPath `
-Width 600 `
-Height 400 `
-ColorPalette Category20 `
-Filename 'Example12-DonutChart'
98 changes: 98 additions & 0 deletions Examples/Example13.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<#
.SYNOPSIS
Example 02 - Donut Chart with Legend, Custom Colors and Border

.DESCRIPTION
This example demonstrates how to create a Donut Chart with additional visual options, including:
- An enabled legend with custom alignment and orientation
- A custom hex color palette
- A chart border
- Adjusted title and label font sizes
- Custom chart dimensions

The chart displays a server operating system distribution report.
#>

[CmdletBinding()]
param (
[System.IO.DirectoryInfo] $Path = (Get-Location).Path,
[string] $Format = 'png'
)

<#
Starting with PowerShell v3, modules are auto-imported when needed. Importing the module here
ensures clarity and avoids ambiguity.
#>

# Import-Module AsBuiltReport.Chart -Force -Verbose:$false

<#
Since the chart output is a file, specify the output folder path using $OutputFolderPath.
#>

$OutputFolderPath = Resolve-Path $Path

<#
Define the data to be displayed in the chart.
In a real-world scenario these values would come from your infrastructure query.
#>

$ChartTitle = 'Server OS Distribution'
$Values = @(85, 60, 30, 15)
$Labels = @('Windows Server 2022', 'Windows Server 2019', 'RHEL 9', 'Ubuntu 22.04')

<#
A custom hex color palette can be used to match corporate branding or improve readability.
Each color corresponds to a slice in the order they appear in $Values.
#>

$CustomColors = @('#0078D4', '#00B7C3', '#E74C3C', '#F39C12')

<#
The New-DonutChart cmdlet generates the Donut Chart image.

-Title : Sets the chart title.
-TitleFontSize : Sets the font size of the title in points.
-TitleFontBold : Renders the title in bold.
-Values : Array of numeric values, one per slice.
-Labels : Array of label strings corresponding to each value.
-LabelFontSize : Sets the font size of the slice labels.
-LabelDistance : Controls how far labels are placed from the chart center (0.5-0.9).
-EnableLegend : Enables the legend on the chart.
-LegendAlignment : Positions the legend (e.g. UpperRight, LowerCenter).
-LegendOrientation : Sets legend layout direction (Vertical or Horizontal).
-LegendFontSize : Sets the legend text font size in points.
-EnableChartBorder : Draws a border around the chart area.
-ChartBorderColor : Sets the border color.
-ChartBorderSize : Sets the border thickness in pixels.
-EnableCustomColorPalette : Enables use of the custom color palette.
-CustomColorPalette : Array of hex color strings for each slice.
-Width : Output image width in pixels.
-Height : Output image height in pixels.
-Format : Output file format (e.g. png, jpg, svg).
-OutputFolderPath : Directory where the generated chart file will be saved.
-Filename : Name of the output file (without extension).
#>

New-DonutChart `
-Title $ChartTitle `
-TitleFontSize 18 `
-TitleFontBold `
-Values $Values `
-Labels $Labels `
-LabelFontSize 13 `
-LabelDistance 0.7 `
-EnableLegend `
-LegendAlignment UpperRight `
-LegendOrientation Vertical `
-LegendFontSize 12 `
-EnableChartBorder `
-ChartBorderColor Black `
-ChartBorderSize 2 `
-EnableCustomColorPalette `
-CustomColorPalette $CustomColors `
-Width 600 `
-Height 400 `
-Format $Format `
-OutputFolderPath $OutputFolderPath `
-Filename 'Example13-DonutChart-Advanced'
8 changes: 4 additions & 4 deletions Sources/AsBuiltReportChart.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- <OutputType>Exe</OutputType> -->
<Version>0.3.2</Version>
<Version>0.3.3</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="8.3.1.3" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="8.3.1.5" />
<PackageReference Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageReference Include="ScottPlot" Version="5.1.58" />
<PackageReference Include="SkiaSharp" Version="3.119.2" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.119.2" />
<PackageReference Include="SkiaSharp" Version="3.119.4" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.119.4" />
</ItemGroup>

</Project>
46 changes: 45 additions & 1 deletion Sources/Chart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal partial class Chart
public static string LabelXAxis { get; set; } = "Values";

// this set the distance of the labels from the chart center (Pie Chart)
internal static double _labelDistance = 0.6;
internal static double _labelDistance;
public static double LabelDistance
{
get { return _labelDistance; }
Expand All @@ -50,6 +50,24 @@ public static double LabelDistance
}
}

// this set the distance of the labels from the chart center (Pie Chart)
internal static double _spokesLength;
public static double SpokesLength
{
get { return _spokesLength; }
set
{
if (value >= 5 && value <= 50)
{
_spokesLength = value;
}
else
{
throw new ArgumentException("Error: SpokesLength value range must be from 5 to 50.");
}
}
}

// this set the orientation chart area (Bar Chart)
public static Orientations AreaOrientation { get; set; } = Orientations.Vertical;

Expand All @@ -71,6 +89,27 @@ public static double AreaExplodeFraction
}
}

// Center text for Donut Chart
public static string DonutCenterText { get; set; }

// this set the distance of the chart area elements (Donut Chart)
internal static double _donutFraction;
public static double DonutFraction
{
get { return _donutFraction; }
set
{
if (value >= 0.0 && value <= 0.5)
{
_donutFraction = value;
}
else
{
throw new ArgumentException("Error: DonutFraction value range must be from 0.0 to 0.5.");
}
}
}

// Legend setting (Pie Chart)
public static bool EnableLegend { get; set; }

Expand All @@ -87,6 +126,9 @@ public static double AreaExplodeFraction

public static Alignments LegendAlignment { get; set; } = Alignments.LowerRight;

// Hide Values
public static bool HideValues { get; set; }

// Chart border settings (All Charts)
public static bool EnableChartBorder { get; set; }
public static BorderStyles ChartBorderStyle { get; set; }
Expand Down Expand Up @@ -439,6 +481,8 @@ internal static void Reset()
WatermarkFontSize = 24;
WatermarkColor = BasicColors.Gray;
_watermarkOpacity = 0.3;
DonutFraction = 0.5;
HideValues = false;
}

public static string GenerateToken(Byte length)
Expand Down
Loading
Loading