New-ExcelChart.ps1

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
function New-ExcelChart {
    param(
        $Title="Chart Title",
        [OfficeOpenXml.Drawing.Chart.eChartType]$ChartType="ColumnStacked",
        $XRange,
        $YRange,
        $Width=500,
        $Height=350,
        $PosRow=0,
        $PosRowOffSetPixels=10,
        $PosColumn=6,
        $PosColumnOffSetPixels=5
    )

    [PSCustomObject]@{
        Title=$Title
        ChartType=$ChartType
        XRange=$XRange
        YRange=$YRange
        Width=$Width
        Height=$Height

        PosRow=$PosRow
        PosRowOffSetPixels=$PosRowOffSetPixels
        PosColumn=$PosColumn
        PosColumnOffSetPixels=$PosColumnOffSetPixels
    }
}