Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Set-OfficeExcelChartDataLabel

Aliases: ExcelChartDataLabel
Module
PSWriteOffice
Aliases
ExcelChartDataLabel
Inputs
OfficeIMO.Excel.ExcelChart

Shows and styles chart data labels.

Syntax

Set-OfficeExcelChartDataLabel
[-Bold]
[-Chart] <ExcelChart>
[-Color <OfficeColor>]
[-FillColor <OfficeColor>]
[-Font <String>]
[-Italic]
[-LineColor <OfficeColor>]
[-LineWidth <OfficeLength>]
[-NoFill]
[-NoLine]
[-NumberFormat <String>]
[-PassThru]
[-Position <OfficeChartDataLabelPosition>]
[-ShowCategoryName]
[-ShowLegendKey]
[-ShowPercent]
[-ShowSeriesName]
[-ShowValue]
[-Size <OfficeLength>]
[-SourceLinked]
[<CommonParameters>]
#
Parameter set: Default

Examples

Show values on a chart

New-OfficeExcel -Path .\Reports\Regions.xlsx {
    ExcelSheet 'Summary' {
        ExcelTable (Import-OfficeCsv -Path .\Data\Region-Revenue.csv) -Name RegionSummary
        ExcelChart -Table RegionSummary -Address F2 -Type Column -PassThru | ExcelChartDataLabel -ShowValue
    }
}

Shows each bar's value on the chart.

Label a share chart with percentages

New-OfficeExcel -Path .\Reports\Cloud-Spend.xlsx {
    ExcelSheet 'Spend' {
        $chart = ExcelChart -InputObject (Import-OfficeCsv -Path .\Data\Spend-By-Service.csv) -Category Service -Value Cost -Address A1 -Type Pie -Title 'Cloud spend by service' -PassThru
        ExcelChartDataLabel -Chart $chart -ShowCategoryName -ShowPercent -Position OutsideEnd -NumberFormat '0%'
    }
}

Labels each slice of a pie chart with its category and percentage outside the slice.

Parameters

-Bold SwitchParameter optional
Applies bold text. An explicit false value clears bold; omission preserves the native value.
-Chart ExcelChart requiredposition: 0pipeline: True (ByValue)
Chart to update.
-Color OfficeColor optional
Text or rule colour expressed as a literal OfficeColor or theme role.
-FillColor OfficeColor optional
Optional label fill color. Named colors and hexadecimal values are accepted.
-Font String optional
Font family name.
-Italic SwitchParameter optional
Applies italic text. An explicit false value clears italic; omission preserves the native value.
-LineColor OfficeColor optional
Optional label line color. Named colors and hexadecimal values are accepted.
-LineWidth OfficeLength optional
Physical line width; numbers are interpreted as points.
-NoFill SwitchParameter optional
Remove label fill.
-NoLine SwitchParameter optional
Remove label border.
-NumberFormat String optional
Optional number format code.
-PassThru SwitchParameter optional
Emits the native result after the operation.
-Position OfficeChartDataLabelPosition optional
Optional data label position.
Possible values: BestFit, Bottom, Center, InsideBase, InsideEnd, Left, OutsideEnd, Right, Top
-ShowCategoryName SwitchParameter optional
Show category names in labels.
-ShowLegendKey SwitchParameter optional
Show legend keys in labels.
-ShowPercent SwitchParameter optional
Show percentages in labels.
-ShowSeriesName SwitchParameter optional
Show series names in labels.
-ShowValue SwitchParameter optional
Show values in labels.
-Size OfficeLength optional
Font size, interpreted as points for numbers; explicit physical units are accepted.
-SourceLinked SwitchParameter optional
Keep number formatting linked to the source cells.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.