Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate chart code to separate function. #132

Closed
2 tasks done
rebelinux opened this issue Jan 9, 2024 · 1 comment · Fixed by #137
Closed
2 tasks done

Migrate chart code to separate function. #132

rebelinux opened this issue Jan 9, 2024 · 1 comment · Fixed by #137
Assignees
Labels
change request Request a new change or an improvement
Milestone

Comments

@rebelinux
Copy link
Collaborator

Description

Migrate chart code to separate function.

$Alljobs = @()
if ($Bkjobs.info.LatestStatus) {
    $Alljobs += $Bkjobs.info.LatestStatus
}
if ((Get-VBRTapeJob -ErrorAction SilentlyContinue).LastResult) {
    $Alljobs += (Get-VBRTapeJob).LastResult
}
if ((Get-VBRSureBackupJob -ErrorAction SilentlyContinue).LastResult) {
    $Alljobs += (Get-VBRSureBackupJob -ErrorAction SilentlyContinue).LastResult
}
$sampleData = $Alljobs | Group-Object
$exampleChart = New-Chart -Name BackupJobs -Width 600 -Height 400

$addChartAreaParams = @{
    Chart                 = $exampleChart
    Name                  = 'BackupJobs'
    AxisXTitle            = 'Status'
    AxisYTitle            = 'Count'
    NoAxisXMajorGridLines = $true
    NoAxisYMajorGridLines = $true
}
$exampleChartArea = Add-ChartArea @addChartAreaParams -PassThru

$addChartSeriesParams = @{
    Chart             = $exampleChart
    ChartArea         = $exampleChartArea
    Name              = 'exampleChartSeries'
    XField            = 'Name'
    YField            = 'Count'
    Palette           = 'Green'
    ColorPerDataPoint = $true
}
$sampleData | Add-ColumnChartSeries @addChartSeriesParams

$addChartTitleParams = @{
    Chart     = $exampleChart
    ChartArea = $exampleChartArea
    Name      = 'BackupJob'
    Text      = 'Jobs Latest Result'
    Font      = New-Object -TypeName 'System.Drawing.Font' -ArgumentList @('Arial', '12', [System.Drawing.FontStyle]::Bold)
}
Add-ChartTitle @addChartTitleParams

$chartFileItem = Export-Chart -Chart $exampleChart -Path (Get-Location).Path -Format "PNG" -PassThru

if ($PassThru)
{
    Write-Output -InputObject $chartFileItem
}

Additional Context

No response

Before submitting

  • I have read the documentation, and referred to the known issues before submitting this change request.
  • I have checked for previously opened & closed issues before submitting this change request.
@rebelinux rebelinux added the change request Request a new change or an improvement label Jan 9, 2024
@rebelinux rebelinux self-assigned this Jan 9, 2024
@rebelinux rebelinux added this to the v0.8.4 milestone Jan 9, 2024
@rebelinux
Copy link
Collaborator Author

Research a way to delete the temporary png leftover

rebelinux added a commit to rebelinux/AsBuiltReport.Veeam.VBR that referenced this issue Jan 16, 2024
@rebelinux rebelinux mentioned this issue Jan 16, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change request Request a new change or an improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant