Autoscale horizontal axis on chart

J

JzP

Hi,
I'm programatically creating PowerPoint slides from vb.net. I use slide
templates and on some of them put data into a datasheet behind a chart.
The data changes fine but I cannot discover how to scale the chart
horizontally. Clicking on the vertical axis in PowerPoint shows the
scale tab with lots of options, but the horizontal axis only has 3
options regarding number of categories between tick marks and where the
Y axis crosses.
Can anyone advise me on how to programatically tell PowerPoint what
scale the chart should use or how to set it to autoscale?

Thanks in advance

John
 
A

Andy Pope

Hi,

The 3 options suggest the horizontal axis is a category axis.
If you want a value axis you will need to use another chart type. If you
have a line chart change it to xy-scatter.

Cheers
Andy
 
J

JzP

Thanks Andy,
I see what you mean. Unfortunately the graph is a combination based on
a template from the user so I may have to just set some limits to what
can be chosen.

Thanks again for your speedy response anyway.

John
 
J

JzP

Andy (or anyone listening),
After further investigation i find that the chart is indeed a
combination (mainly lines but with 2 series changed to columns).
I had an idea of changing the columns to lines, then changing the whole
chart to xy-scatter. If I do that directly in PowerPoint the chart then
resizes correctly. I then go into the format axis option and turn off
the autoscales but when I change the type back to a line it adds extra
columns at the end again.
I have two questions.
1. Should it be possible to do what I am suggesting in PowerPoint?
2. If so, could it be done programatically? I'm having a problem
finding the appropriate properties of the chart to change in VBA.

Any suggestions would be most welcome.

Thanks

John
 
J

JzP

Me again,
I'm not trying to clog up the group but I thought I'd share what I've
discovered so far so as not to waste anyone's time.
Changing a line chart to an x-y scatter, playing with it and changing
it back doesn't work as PowerPoint somewhere keeps a record of how wide
it thinks the chart is.
Instead, I have discovered I can start with a scatter chart, paste new
data into the datasheet, then convert it to a line chart and then
convert the 2 series to columns!
All I have to do now is do is do the same in vb.net code.
I did finally track down the vba properties of the seriescollection as
"ActivePresentation.Slides(1).Shapes(2).OLEFormat.Object.Application.chart.seriescollection(1)"
but I'm having trouble trying to find the values from the series.

Thanks for reading this.

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top