Last active
February 22, 2019 00:03
-
-
Save dfinke/6b19531030b63cbaee49dd42ecab4d94 to your computer and use it in GitHub Desktop.
$chart.DataLabel.ShowValue = $true - Shows the data labels in the chart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$xlfile = "$env:TEMP\datalabels.xlsx" | |
rm $xlfile -ErrorAction SilentlyContinue | |
$data = 1..20 | % { | |
[PSCustomObject]@{Idx=$_; Amount=Get-Random -Minimum 10 -Maximum 100} | |
} | |
$excel = $data | Export-Excel -Path $xlfile -AutoNameRange -PassThru | |
$chartParams = @{ | |
Worksheet = $excel.Workbook.Worksheets["Sheet1"] | |
XRange = "Idx" | |
YRange = "Amount" | |
Title = "The Title" | |
ChartType = "ColumnClustered" | |
SeriesHeader = "The Data" | |
} | |
$chart = Add-ExcelChart @chartParams -PassThru | |
$chart.DataLabel.ShowValue = $true | |
Close-ExcelPackage $excel -Show |
Author
dfinke
commented
Feb 22, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment