Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default Bar Chart Label Sizes

I am dynamically populating multiple Horizontal Bar Charts with Data. I
want the Labels (y axes) and chart area (Bar Charts) to be the same on
each chart. When I dynamically set the data the labels and charts
resize themselves based on the width of the data.

Is there a way through code VBA, C#, etc that I can set the width of
the Graphic (the bar charts --no labels) independently of the width of
the labels (the y axis). I haved tried xlChart.Chart.PlotArea.Width but
it appears to be the width of both of these areas together? Any other
thoughts.

Thanks In Advance

  #2   Report Post  
Jon Peltier
 
Posts: n/a
Default

Bob -

You've touched on one of the frustrating aspects of Excel charting. You cannot get
these to exactly match up, but you can get close. First let's clear up some terminology.

The Chart Area is the outermost rectangle of a chart. It is the part that is
included in a chart object which is embedded in a worksheet, or that includes the
chart in a chart sheet. The Plot Area includes the charting rectangle and all of the
axis features (ticks and tick labels). The Plot Inside Area comprises the rectangle
which is defined by the axes and includes all of the plotted points.

In VBA (or C#, whatever), the Plot Area dimensions are read-write, the Plot Inside
Area dimensions are read-only. But you want to control the Plot Inside Area, so you
have to tweak the Plot Area until the Plot Inside Area comes up right (or within a
pixel).

The trick is to make the Plot Area smaller than you need (make its .Width and
..Height like half the size you need), set the Plot Area's .Left and .Top so the Plot
Inside Area is where you want it, then set the Plot Area size so the Inside Area is
what you need. Make sure there is room for the Plot Area to expand to include longer
labels, or Excel will change the Inside Area to fit.

This zipped workbook contains code to standardize the Plot Inside Areas of charts
embedded in a worksheet. Sometimes it is necessary to run the code twice.

http://peltiertech.com/Excel/Zips/Al...Dimensions.zip

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

wrote:

I am dynamically populating multiple Horizontal Bar Charts with Data. I
want the Labels (y axes) and chart area (Bar Charts) to be the same on
each chart. When I dynamically set the data the labels and charts
resize themselves based on the width of the data.

Is there a way through code VBA, C#, etc that I can set the width of
the Graphic (the bar charts --no labels) independently of the width of
the labels (the y axis). I haved tried xlChart.Chart.PlotArea.Width but
it appears to be the width of both of these areas together? Any other
thoughts.

Thanks In Advance


  #3   Report Post  
 
Posts: n/a
Default

Thanks Jon!!

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
Impedding/Overlaying Charts Phil Hageman Charts and Charting in Excel 4 December 17th 04 08:25 PM
Chart Label wraps on the same line. "Wavelenght [nm]" appears as. rog Charts and Charting in Excel 1 December 15th 04 09:10 PM
pivot table multi line chart souris Charts and Charting in Excel 2 December 7th 04 04:56 AM
the dates to label the x axis on the scatter chart won't print waterlady Charts and Charting in Excel 0 November 29th 04 07:44 PM
Why do my text boxes disappear from my chart when I click out? Robboo Charts and Charting in Excel 1 November 27th 04 06:49 PM


All times are GMT +1. The time now is 08:10 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"