Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default .PlotArea size changes when a series is added

I have created a chart programattically and sized the plot area like this.

With .ActiveChart.PlotArea
.Interior.ColorIndex = Excel.Constants.xlNone
.Width = 385
.Height = 290
.Left = 30
.Top = 20
End With

However, later in my code I add a series to that chart using this code.

With objEx
.ActiveSheet.ChartObjects("Chart " & testcase.index).Select()
seriesnum = .ActiveChart.SeriesCollection.count + 1
.ActiveChart.SeriesCollection.NewSeries()
.ActiveChart.SeriesCollection(seriesnum).Name = strOutSheet
.ActiveChart.SeriesCollection(seriesnum).XValues = "='" & strOutSheet &
"'!R" & rowspot(0) & "C" & colspot(0) & ":R" & rowspot(1) & "C" & colspot(0)
.ActiveChart.SeriesCollection(seriesnum).Values = "='" & strOutSheet &
"'!R" & rowspot(0) & "C" & colspot(1) & ":R" & rowspot(1) & "C" & colspot(1)
.ActiveChart.SeriesCollection(seriesnum).Border.Co lorIndex = intColor

'adjust legend size and entry color based on pass/fail status
With .ActiveChart.Legend
If lcheck.pass Then
.LegendEntries(.LegendEntries.Count).Font.ColorInd ex = 10 'green
Else
.LegendEntries(.LegendEntries.Count).Font.ColorInd ex = 3 'red
End If
End With
End With

Why does adding this series change the .PlotArea size/location? I have set
Excel to visible and turned screen updating on so I know the size changes on
this line:

..ActiveChart.SeriesCollection(seriesnum).XValues = "='" & strOutSheet &
"'!R" & rowspot(0) & "C" & colspot(0) & ":R" & rowspot(1) & "C" & colspot(0)

Any suggestions? This is extremely annoying!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default .PlotArea size changes when a series is added

Hi,

The plotarea dimensions can change due to changes in the axis labels.
If either the x or y axis causes addition information to be displayed
the size can change. For example Y values increasing so an extra digit
is required to show new values.

Cheers
Andy

BBauer42 wrote:
I have created a chart programattically and sized the plot area like this.

With .ActiveChart.PlotArea
.Interior.ColorIndex = Excel.Constants.xlNone
.Width = 385
.Height = 290
.Left = 30
.Top = 20
End With

However, later in my code I add a series to that chart using this code.

With objEx
.ActiveSheet.ChartObjects("Chart " & testcase.index).Select()
seriesnum = .ActiveChart.SeriesCollection.count + 1
.ActiveChart.SeriesCollection.NewSeries()
.ActiveChart.SeriesCollection(seriesnum).Name = strOutSheet
.ActiveChart.SeriesCollection(seriesnum).XValues = "='" & strOutSheet &
"'!R" & rowspot(0) & "C" & colspot(0) & ":R" & rowspot(1) & "C" & colspot(0)
.ActiveChart.SeriesCollection(seriesnum).Values = "='" & strOutSheet &
"'!R" & rowspot(0) & "C" & colspot(1) & ":R" & rowspot(1) & "C" & colspot(1)
.ActiveChart.SeriesCollection(seriesnum).Border.Co lorIndex = intColor

'adjust legend size and entry color based on pass/fail status
With .ActiveChart.Legend
If lcheck.pass Then
.LegendEntries(.LegendEntries.Count).Font.ColorInd ex = 10 'green
Else
.LegendEntries(.LegendEntries.Count).Font.ColorInd ex = 3 'red
End If
End With
End With

Why does adding this series change the .PlotArea size/location? I have set
Excel to visible and turned screen updating on so I know the size changes on
this line:

.ActiveChart.SeriesCollection(seriesnum).XValues = "='" & strOutSheet &
"'!R" & rowspot(0) & "C" & colspot(0) & ":R" & rowspot(1) & "C" & colspot(0)

Any suggestions? This is extremely annoying!!


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text Boxes added to Chart Series Feather 52 Charts and Charting in Excel 2 January 16th 08 10:31 PM
trouble setting plotarea size Albert Excel Programming 2 August 31st 06 05:00 PM
Problem to modify the size of PlotArea Xavier Charts and Charting in Excel 1 April 24th 06 10:56 PM
automatic series readjustment when Inew row added [email protected] Charts and Charting in Excel 1 April 11th 06 11:52 AM
series graph -- one series being added to another series rich zielinski via OfficeKB.com Charts and Charting in Excel 3 March 30th 05 06:23 PM


All times are GMT +1. The time now is 03:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"