Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling plot area dimensions in mschart 1

Status
Not open for further replies.

N1GHTEYES

Technical User
Joined
Jun 18, 2004
Messages
771
Location
GB
Hi,

I'm displaying some x,y data on an mschart. The number of points in the series can vary from ~ 10 to several hundred points.

The problem I'm having is that the number of points seems to drive the width of the displayed plot. If the displayed data has hundreds of points, the width of the plot area of the chart is readable, but as the number of points reduces, the width of the plot area display also shrinks. How do I control the plot area height and width?

I've tried using the plot.locationrect object but this only allows me to alter the min & max x & y values. When I do this the position of the plot changes within the chart, but not its width.

I've tried to figure this out using the VB help for mschart, but it is not very helpful. So if anyone knows of a really helpful, detailed tutorial somewhere out there on the internet, please let me know.

Tony
 
I've never used it in VB6, only in Access. If it works the same, try going to chart options|axes and make sure the category axis is not set to "automatic".

Ni neart go cur le cheile.
 
genomon

Thanks for the response. I set both the categoryscale and valuescale .auto properties to false.

Having done that, it still only moves the plot area in response to changing the locationrect max and min values - it does not alter the width.

I tried changing the valuscale.maximum value to a higher number. This does change the width of the displayed plot area, but it also (as you might expect) changes the maximum value of the x axis, so the actual width of the data being plotted stays the same.

I suspected that it might be something to do with the plot.widthtoheightratio property, so I tried changing that too, but it seemed to have no effect.

Tony
 


Code:
with YourChartObject.PlotArea
  .Width = SomeWidth
  .Height = SomeHeight
end with
Caveat: the PlotArea dimensions are limited by the ChartArea dimensions.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Skip,

I'm not following you. The mschart object does not seem to have a plotarea property, at least, not in VB6, which I'm using.

There is a plot propety, but that does not have a width property.

You're not thinking of Excel charts are you?

Tony
 


Yes. I mistakenly assumed that they must be similar.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Skip,

I wish they were. In Excel all I'd need to do to figure it out is record a macro whilst changing the width manually.

Unfortunately, all I've got in this instance is the crappy unhelpful "Help" for mschart, which tells me virtually nothing I need to know.

I've tried googling for tutorials on mschart, but mostly what you get is other people's requests for good mschart tutorials! The ones I have found are dealing with stuff like "how do I get my data in there", or esoteric stuff like controlling the lighting in 3d chart. There may well be a good tutorial or detailed help file out there, but so far trying to find it has involved several hours of wading through irelevant guff.

So, if you, or anyone else DOES know of a useful info source, please feel free to let me know.

Tony
 
Change the Plot object's AutoLayout property to False, then the LocationRect will indeed allow you to specify the plot position and size as you wish (remembering that it is in twips)

This is fully documented (um, apart from the twip bit) in the VB6 MSDN help files under both LocationRect and AutoLayout
 
Cracked it!

If anyone else in the future searches through this thread trying to find the answer to the question I was asking , here it is.

Set the mschart.plot.uniformaxis property to FALSE.

Otherwise, for some weird reason known only to MS, the x and y axis scales are forced to be the same. I can't easily see why they would want to include such an esoteric option, and I certainly can't see why it would be the default, but clearly the ways of MS are beyond the mind of man.

Tony
 
George,

I sent the above message before I saw your reply.

I had already set AutoLayout to false. This does indeed allow you to move the plot area, but it does not allow you to change the width of it unless you also set uniformaxis to false.

Tony
 
Sorry, Mike?

I was multi-tasking and and a bit frazzled. The message had about a tenth of my attention. I mentally transposed strongm for gmastros (another exceptionally helpful chappie).

Even if my scattered brain got your name wrong, I'd like to say how much I appreciate all the incredibly helpful contributions you've made here.

Thanks,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top