Cmdlet
Add-OfficePowerPointChart
Adds a chart to a PowerPoint slide.
Syntax
Add-OfficePowerPointChart
[-Column <Int32>]
[-Height <OfficeLength>]
[-PassThru]
[-Slide <PowerPointSlideSelector>]
[-Span <Int32>]
[-Title <String>]
[-Type <OfficeChartType>]
[-Width <OfficeLength>]
[-X <OfficeLength>]
[-Y <OfficeLength>]
[<CommonParameters>]#Parameter set:
SampleAdd-OfficePowerPointChart
-Category <String>
[-Column <Int32>]
[-Height <OfficeLength>]
-InputObject <Object[]>
[-PassThru]
[-Slide <PowerPointSlideSelector>]
[-Span <Int32>]
[-Title <String>]
[-Type <OfficeChartType>]
-Value <String[]>
[-Width <OfficeLength>]
[-X <OfficeLength>]
[-Y <OfficeLength>]
[<CommonParameters>]#Parameter set:
InputObjectDescription
Supports default chart data or object-based category/series mappings for standard and scatter charts.
Examples
Add a clustered column chart from objects.
$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 -PassThru
Add-OfficePowerPointChart -Slide $slide -InputObject $rows -Category Month -Value Sales,Profit -Title 'Monthly performance'
}Creates a clustered column chart using Month for categories and Sales/Profit as series.
Add a scatter chart from numeric properties.
$rows = @(
[pscustomobject]@{ Quarter = 1; Revenue = 20 }
[pscustomobject]@{ Quarter = 2; Revenue = 34 }
)
New-OfficePowerPoint -Path .\Examples\Documents\PowerPointScatter.pptx {
$slide = Add-OfficePowerPointSlide -PassThru
Add-OfficePowerPointChart -Slide $slide -Type Scatter -InputObject $rows -Category Quarter -Value Revenue -Title 'Revenue trend'
}Creates a scatter chart using Quarter on the X axis and Revenue on the Y axis.
Parameters
- -Column Int32
- One-based start column in the native twelve-column grid; explicit X overrides it.
- -Height OfficeLength
- Chart height; numbers mean points.
- -PassThru SwitchParameter
- Emit the object created or changed by the command.
- -Slide PowerPointSlideSelector
- Target slide that will receive the chart (optional inside DSL).
- -Span Int32
- Number of grid columns; defaults to twelve, and explicit Width overrides it.
- -Title String
- Optional chart title.
- -Type OfficeChartType
- Chart type to create.
- Possible values:
ColumnClustered,Column,ColumnStacked,ColumnStacked100,BarClustered,Bar,BarStacked,BarStacked100,Line,LineStacked,LineStacked100,Area,AreaStacked,AreaStacked100,Scatter,Radar,Pie,Doughnut,Bubble,Column3DClustered,Column3DStacked,Column3DStacked100,Bar3DClustered,Bar3DStacked,Bar3DStacked100,Line3D,Area3D,Area3DStacked,Area3DStacked100,Pie3D,PieOfPie,BarOfPie,Stock,Surface,SurfaceWireframe,SurfaceContour,Funnel,Waterfall,BoxWhisker,Treemap,SurfaceContourWireframe,Sunburst - -Width OfficeLength
- Chart width; numbers mean points.
- -X OfficeLength
- Left offset from the slide origin; numbers mean points.
- -Y OfficeLength
- Top offset from the slide origin; numbers mean points.
- -Category String
- Property used for category labels, or numeric X values on scatter charts.
- -InputObject Object[]
- Source objects used to build chart data.
- -Value String[]
- Properties used as numeric series, or Y series on scatter charts.
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.