API Reference
Cmdlet
Add-OfficePowerPointChart
Adds a chart to a PowerPoint slide.
Remarks
Supports default chart data or object-based category/series mappings for standard and scatter charts.
Examples
Example 1: Add a clustered column chart from objects.
PS>
$rows = @(
[pscustomobject]@{ Month = 'Jan'; Sales = 42; Profit = 9 }
[pscustomobject]@{ Month = 'Feb'; Sales = 55; Profit = 13 }
)
New-OfficePowerPoint -Path .\Examples\Documents\PowerPointChart.pptx {
$slide = Add-OfficePowerPointSlide -Layout 1
Add-OfficePowerPointChart -Slide $slide -InputObject $rows -CategoryProperty Month -SeriesProperty Sales,Profit -Title 'Monthly performance'
}
Creates a clustered column chart using Month for categories and Sales/Profit as series.
Example 2: Add a scatter chart from numeric properties.
PS>
$rows = @(
[pscustomobject]@{ Quarter = 1; Revenue = 20 }
[pscustomobject]@{ Quarter = 2; Revenue = 34 }
)
New-OfficePowerPoint -Path .\Examples\Documents\PowerPointScatter.pptx {
$slide = Add-OfficePowerPointSlide -Layout 1
Add-OfficePowerPointChart -Slide $slide -Type Scatter -InputObject $rows -XProperty Quarter -YProperty Revenue -Title 'Revenue trend'
}
Creates a scatter chart using Quarter on the X axis and Revenue on the Y axis.
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.
Syntax
Add-OfficePowerPointChart [-Height <Double>] [-Slide <PowerPointSlide>] [-Title <String>] [-Type <ClusteredColumn|Line|Pie|Doughnut|Scatter>] [-Width <Double>] [-X <Double>] [-Y <Double>] [<CommonParameters>]#Parameter set:
DefaultParameters
- Height Double
- Chart height in points.
- Slide PowerPointSlide
- Target slide that will receive the chart (optional inside DSL).
- Title String
- Optional chart title.
- Type PowerPointChartType
- Chart type to create. Possible values: ClusteredColumn, Line, Pie, Doughnut, Scatter
- Possible values:
ClusteredColumn,Line,Pie,Doughnut,Scatter - Width Double
- Chart width in points.
- X Double
- Left offset in points from the slide origin.
- Y Double
- Top offset in points from the slide origin.
Outputs
OfficeIMO.PowerPoint.PowerPointChart
Add-OfficePowerPointChart -CategoryProperty <String> [-Height <Double>] -InputObject <Object[]> -SeriesProperty <String[]> [-Slide <PowerPointSlide>] [-Title <String>] [-Type <ClusteredColumn|Line|Pie|Doughnut|Scatter>] [-Width <Double>] [-X <Double>] [-Y <Double>] [<CommonParameters>]#Parameter set:
CategoricalParameters
- CategoryProperty String
- Property name used for category labels on standard charts.
- Height Double
- Chart height in points.
- InputObject Object[]
- Source objects used to build chart data.
- SeriesProperty String[]
- Property names used as numeric series on standard charts.
- Slide PowerPointSlide
- Target slide that will receive the chart (optional inside DSL).
- Title String
- Optional chart title.
- Type PowerPointChartType
- Chart type to create. Possible values: ClusteredColumn, Line, Pie, Doughnut, Scatter
- Possible values:
ClusteredColumn,Line,Pie,Doughnut,Scatter - Width Double
- Chart width in points.
- X Double
- Left offset in points from the slide origin.
- Y Double
- Top offset in points from the slide origin.
Outputs
OfficeIMO.PowerPoint.PowerPointChart
Add-OfficePowerPointChart [-Height <Double>] -InputObject <Object[]> [-Slide <PowerPointSlide>] [-Title <String>] [-Type <ClusteredColumn|Line|Pie|Doughnut|Scatter>] [-Width <Double>] [-X <Double>] -XProperty <String> [-Y <Double>] -YProperty <String[]> [<CommonParameters>]#Parameter set:
ScatterParameters
- Height Double
- Chart height in points.
- InputObject Object[]
- Source objects used to build chart data.
- Slide PowerPointSlide
- Target slide that will receive the chart (optional inside DSL).
- Title String
- Optional chart title.
- Type PowerPointChartType
- Chart type to create. Possible values: ClusteredColumn, Line, Pie, Doughnut, Scatter
- Possible values:
ClusteredColumn,Line,Pie,Doughnut,Scatter - Width Double
- Chart width in points.
- X Double
- Left offset in points from the slide origin.
- XProperty String
- Property name used for the X axis on scatter charts.
- Y Double
- Top offset in points from the slide origin.
- YProperty String[]
- Property names used as numeric Y series on scatter charts.
Outputs
OfficeIMO.PowerPoint.PowerPointChart