Command
New-ImageChart
Creates an image chart from definitions.
Syntax
New-ImageChart
[-Annotation <Object[]>]
[-AnnotationsDefinition <ScriptBlock>]
[-Background <ChartColor>]
[-ChartsDefinition] <ScriptBlock>
[-Dpi <Double>]
-FilePath <String>
[-Height <Int32>]
[-Options <ChartRenderOptions>]
[-PassThru]
[-Show]
[-ShowGrid]
[-Theme <ChartTheme>]
[-Watermark <VisualWatermark[]>]
[-Width <Int32>]
[-XTitle <String>]
[-YTitle <String>]
[<CommonParameters>]#Parameter set:
ScriptBlockNew-ImageChart
[-Annotation <Object[]>]
[-AnnotationsDefinition <ScriptBlock>]
[-Background <ChartColor>]
-ChartScript <ScriptBlock>
[-Dpi <Double>]
-FilePath <String>
[-Height <Int32>]
[-Options <ChartRenderOptions>]
[-PassThru]
[-Show]
[-ShowGrid]
[-Theme <ChartTheme>]
[-Watermark <VisualWatermark[]>]
[-Width <Int32>]
[-XTitle <String>]
[-YTitle <String>]
[<CommonParameters>]#Parameter set:
ChartScriptNew-ImageChart
[-Annotation <Object[]>]
[-AnnotationsDefinition <ScriptBlock>]
[-Background <ChartColor>]
-Chart <Chart>
[-Dpi <Double>]
-FilePath <String>
[-Height <Int32>]
[-Options <ChartRenderOptions>]
[-PassThru]
[-Show]
[-ShowGrid]
[-Theme <ChartTheme>]
[-Watermark <VisualWatermark[]>]
[-Width <Int32>]
[-XTitle <String>]
[-YTitle <String>]
[<CommonParameters>]#Parameter set:
ChartNew-ImageChart
[-Annotation <Object[]>]
[-AnnotationsDefinition <ScriptBlock>]
[-Background <ChartColor>]
-Definition <Object[]>
[-Dpi <Double>]
-FilePath <String>
[-Height <Int32>]
[-Options <ChartRenderOptions>]
[-PassThru]
[-Show]
[-ShowGrid]
[-Theme <ChartTheme>]
[-Watermark <VisualWatermark[]>]
[-Width <Int32>]
[-XTitle <String>]
[-YTitle <String>]
[<CommonParameters>]#Parameter set:
DefinitionDescription
Use this cmdlet to render one or more chart definitions into a final image file.
Examples
Create a simple bar chart and save it
New-ImageChart -ChartsDefinition {
New-ImageChartBar -Name 'Q1' -Value 12,18,25 -Color CornflowerBlue
New-ImageChartBar -Name 'Q2' -Value 14,20,28 -Color Orange
} -FilePath chart.png -XTitle 'Month' -YTitle 'Revenue'Builds chart definitions inside a script block and renders them into a PNG file.
Create a line chart with annotations and preview it
$defs = @(
New-ImageChartLine -Name 'CPU' -Value 35,42,58,61,49 -Color LimeGreen -Smooth
)
$ann = @(
New-ImageChartAnnotation -X 3 -Y 61 -Text 'Peak' -Arrow
)
New-ImageChart -Definition $defs -Annotation $ann -FilePath cpu-usage.png -Theme Dark -ShowGrid -ShowRenders a themed line chart and overlays an annotation highlighting the peak value.
Parameters
- -Annotation Object[]
- Annotations for the chart.
- -AnnotationsDefinition ScriptBlock
- ScriptBlock producing annotations.
- -Background ChartColor
- Chart background color.
- -ChartsDefinition ScriptBlock
- ScriptBlock producing chart definitions.
- -Dpi Double
- PNG physical resolution metadata in dots per inch.
- -FilePath String
- The image format is inferred from the file extension.
- -Height Int32
- Height of the chart.
- -Options ChartRenderOptions
- Renderer options created by New-ImageChartOptions.
- -PassThru SwitchParameter
- Write the ChartForgeX chart to the pipeline after rendering.
- -Show SwitchParameter
- Open the image after creation.
- -ShowGrid SwitchParameter
- Display grid lines.
- -Theme ChartTheme
- Chart theme.
- Possible values:
Default,Dark,Light,Colorblind,Aurora,Editorial,Candy,PeopleInfographic,Terminal,TransparentOverlayDark,Minimal,DashboardLight,SaasDashboardLight,RestaurantDashboardLight - -Watermark VisualWatermark[]
- Watermarks applied to static SVG, HTML, or PNG output.
- -Width Int32
- Width of the chart.
- -XTitle String
- X axis title.
- -YTitle String
- Y axis title.
- -ChartScript ScriptBlock
- The script block receives the chart as its first argument and can mutate it directly or return a replacement chart.
- -Chart Chart
- ChartForgeX chart object to render.
- -Definition Object[]
- Chart definitions provided directly.
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.