Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

plot area inconsistent sizes with VBA

503 views
Skip to first unread message

Robert H

unread,
Dec 15, 2008, 9:30:58 AM12/15/08
to
I run a series of charts on a single sheet that look at different but
similar types of data. the x-axis values are always the same. The y-
axis is the same count but different ranges of values. The charts are
set to be the same size and the plots are set to be the same size. On
some of the resulting charts the plot height is slightly smaller and
the plot width is about half even though the the plot areas are full
size.

here is the segment of code

With .Parent
.Top = chtLoc1.Offset(26, 0).Top
.Left = chtLoc1.Left
.Height = 252
.Width = 432
.Name = chtNm
End With


With ActiveChart.PlotArea
.Top = 20
.Height = 221
.Left = 0
.Width = 340
End With

the inconstancies occur at .plotarea.height and .width

I thing there must be another setting that is unique to the two charts
that this occurs on. the same code is cycled through to create each
chart.

Thanks
Robert

John West

unread,
Jul 26, 2010, 12:36:06 AM7/26/10
to
I have been trying to solve the same problem. I want to create charts all the same width and height (particularly width) to align them neatly, except depending on the y-axis value (no. of digits) the chart changes width...!

So despite defining the widths for Shape, ChartObject, ChartArea, and PlotArea as the same for two charts they can actually have different widths visually. It's infuriating and there must be some hidden variable somewhere. Any ideas...?

'Setting widths
sName = ActiveChart.Parent.Name
ActiveSheet.Shapes(sName).Width = nWidth

With ActiveChart
.Parent.Width = nWidth
.ChartArea.Width = nWidth
.PlotArea.Width = nWidth
End With

Robert H wrote:

plot area inconsistent sizes with VBA
16-Dec-08

Thanks
Robert

Previous Posts In This Thread:

On Tuesday, December 16, 2008 1:30 AM
Robert H wrote:

plot area inconsistent sizes with VBA

Thanks
Robert


Submitted via EggHeadCafe - Software Developer Portal of Choice
Win a Free License of SandRibbon for Silverlight
http://www.eggheadcafe.com/tutorials/aspnet/cb3912a1-be37-4032-a71a-598cae18c0d7/win-a-free-license-of-sandribbon-for-silverlight.aspx

Jon Peltier

unread,
Jul 26, 2010, 9:18:17 AM7/26/10
to
Robert -

The PlotArea has read-only properties .InsideLeft, .InsideTop,
.InsideWidth, and .InsideHeight, which define the dimensions of the
rectangle defined by the axes. You cannot change them directly, but you
can adjust the read/write properties .Left, .Top, .Width, and .Height in
order to fix the inside dimensions. When the configuration of axis
labels changes, you will likely need to repeat the resizing exercise.

Long ago I posted a routine within the following zip file which carries
out a resizing of chart plot area dimensions to unify the dimensions of
their plot area inside dimensions.

Align Chart Dimensions
http://peltiertech.com/Excel/Zips/AlignChartDimensions.zip

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
774-275-0064
http://peltiertech.com/

0 new messages