Check if trendline was requested

This commit is contained in:
dfinke
2019-06-15 14:21:37 -04:00
parent 3ce485a144
commit 8131eee50f

View File

@@ -387,13 +387,15 @@ function Add-ExcelChart {
$chartDefCount = @($YRange).Count
if ($chartDefCount -eq 1) {
$Series = $chart.Series.Add($YRange, $XRange)
if ($ChartType -notmatch "stacked|3D$|pie|Doughnut|Cone|Cylinder|Pyramid") {
foreach ($trendLine in $ChartTrendLine) {
$null = $Series.TrendLines.Add($trendLine)
if ($ChartTrendLine) {
if ($ChartType -notmatch "stacked|3D$|pie|Doughnut|Cone|Cylinder|Pyramid") {
foreach ($trendLine in $ChartTrendLine) {
$null = $Series.TrendLines.Add($trendLine)
}
}
else {
Write-Warning "Chart trend line is not supported for chart type: $ChartType"
}
}
else {
Write-Warning "Chart trend line is not supported for chart type: $ChartType"
}
if ($SeriesHeader) { $Series.Header = $SeriesHeader }
else { $Series.Header = 'Series 1' }