mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-10 13:23:29 +00:00
Added chart trendline example
This commit is contained in:
27
Examples/Charts/NumberOfVisitors.ps1
Normal file
27
Examples/Charts/NumberOfVisitors.ps1
Normal file
@@ -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
|
||||||
|
|
||||||
Reference in New Issue
Block a user