PC Review


Reply
Thread Tools Rate Thread

Chart Type - numeric values

 
 
Matt McQueen
Guest
Posts: n/a
 
      20th Nov 2008
Alright folks,

I'm trying to write some code that determines whether a chart axis has the
following properties:

minimumscale
maximumscale
majorunit
minorunit
minimumscaleisauto
maximumscaleisauto
minorunitisauto
majorunitisauto

Obviously not all chart types have these properties. The code I'm using to
try and get these values is:

varMinimumScale = ActiveChart.Axes(xlCategory,xlPrimary).MinimumScale

where varMinimumScale is a variant.

Clearly, if the chart is a bar chart, for example, this will crash (a 1004
error).

I've failed in trying to determine this association using If
ActiveChart.ChartType = xlWhatever because apparently my charts are of type
-4111 (they're all scatter plots with two y-axes and lines without markers).
I can't find any mention of numeric chart types in the helpfile or on the
net. Putting a break in the code and progressing step by step shows that
xlXYScatter also produces a number in the -4000 range, whereas other charts
have numbers more like 0-100.

Does anyone have a list of excel's numeric chart types or some code that
would do the job for me (by trapping the 1004 error or something clever)?

Cheers,

Matt
 
Reply With Quote
 
 
 
 
Andy Pope
Guest
Posts: n/a
 
      20th Nov 2008
Hi,

You would have more luck with the charttype if you found out the
information from the series rather than the chart.

ActiveChart.SeriesCollection(1).charttype = xlWhatever

The other thing to do is use error handling. If you wrote some wrapper
functions to get each of the required properties you could handle the
error within the routine and return relevant information.

Cheers
Andy


Matt McQueen wrote:
> Alright folks,
>
> I'm trying to write some code that determines whether a chart axis has the
> following properties:
>
> minimumscale
> maximumscale
> majorunit
> minorunit
> minimumscaleisauto
> maximumscaleisauto
> minorunitisauto
> majorunitisauto
>
> Obviously not all chart types have these properties. The code I'm using to
> try and get these values is:
>
> varMinimumScale = ActiveChart.Axes(xlCategory,xlPrimary).MinimumScale
>
> where varMinimumScale is a variant.
>
> Clearly, if the chart is a bar chart, for example, this will crash (a 1004
> error).
>
> I've failed in trying to determine this association using If
> ActiveChart.ChartType = xlWhatever because apparently my charts are of type
> -4111 (they're all scatter plots with two y-axes and lines without markers).
> I can't find any mention of numeric chart types in the helpfile or on the
> net. Putting a break in the code and progressing step by step shows that
> xlXYScatter also produces a number in the -4000 range, whereas other charts
> have numbers more like 0-100.
>
> Does anyone have a list of excel's numeric chart types or some code that
> would do the job for me (by trapping the 1004 error or something clever)?
>
> Cheers,
>
> Matt


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
 
Reply With Quote
 
Matt McQueen
Guest
Posts: n/a
 
      21st Nov 2008
Andy,

SeriesCollection(x).ChartType looks good, but I think there'd be problems
when you've got things like area plots, since they may or may not have the
values I was looking for (i.e. .ChartType may return 76, but this doesn't
mean there's a minimumscaleisauto value). I think this just indicates that
ChartType (for the chart or the series) is not going to provide what I want.

Writing some error handling code looks like the way to go, since it'll
always generate an error. I'd sort of given up on it when I read in the
help-file that a 1004 error was not a trappable one, but I'll read up on it
and give it a bash. Any tips?

Cheers,

Matt
 
Reply With Quote
 
Matt McQueen
Guest
Posts: n/a
 
      21st Nov 2008
OK, did some error trapping stuff to solve the issue.

Thanks for your help.

Matt
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
numeric values in a chart kurtz Microsoft Excel Charting 4 6th Oct 2008 09:23 PM
how do i show non-numeric values graphically in a chart? =?Utf-8?B?R2VycnkgQw==?= Microsoft Excel Charting 3 4th Mar 2007 03:10 PM
Non-Numeric values in X axis of a scatter chart penasm Microsoft Excel Misc 1 28th Oct 2004 05:44 PM
Scatter Chart with non-numeric values on X axis penasm Microsoft Excel Charting 1 28th Oct 2004 05:37 PM
Is it possible? A Chart with no numeric values andy_dyer Microsoft Excel Charting 3 15th Mar 2004 06:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:43 PM.