From b99b7ba7999c2150a62a3a3e6d3ae09a699fac92 Mon Sep 17 00:00:00 2001 From: dfinke Date: Tue, 18 Jun 2019 14:47:09 -0400 Subject: [PATCH] Added chart trendline example --- Examples/Charts/NumberOfVisitors.ps1 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Examples/Charts/NumberOfVisitors.ps1 diff --git a/Examples/Charts/NumberOfVisitors.ps1 b/Examples/Charts/NumberOfVisitors.ps1 new file mode 100644 index 0000000..b3c8517 --- /dev/null +++ b/Examples/Charts/NumberOfVisitors.ps1 @@ -0,0 +1,27 @@ +$xlfile = "$env:TEMP\visitors.xlsx" +Remove-Item $xlfile -ErrorAction SilentlyContinue + +$data = ConvertFrom-Csv @" +Week, TotalVisitors +1,11916 +2,11665 +3,13901 +4,15444 +5,21592 +6,15057 +7,26187 +8,20662 +9,28935 +10,32443 +"@ + +$cd = New-ExcelChartDefinition ` + -XRange Week ` + -YRange TotalVisitors ` + -Title "No. Of Visitors" ` + -ChartType ColumnClustered ` + -NoLegend ` + -ChartTrendLine Linear + +$data | Export-Excel $xlfile -Show -AutoNameRange -AutoSize -TableName Visitors -ExcelChartDefinition $cd +