GroganJ
asked on
Setting X-Axis labels with a ChartSpace
I'm using an OWC11 ChartSpace object on a userform. It contains 1 chart and the x-axis is a set of dates to correspond to the y-values. The ChartType is a LineType.
How do I set the X-axis labels to my dates using VBA? I'm using Office 2003.
How do I set the X-axis labels to my dates using VBA? I'm using Office 2003.
Do you have a spreadsheet control that you are using for the data or is the whole thing populated in code?
ASKER
rorya - the entire thing is programmed from VBA. I'm not using Excel at all.
ASKER
Werafa - I had tried that, but the methods that a recorded macro picks up do not all exist in the OWC11 object. And specifically, the methods around setting the x-axis.
If vba doesn't let you change the axes, can anyone recommend a third party object that does allow me more control over graphing? Cheap is good, free is better :-)
If vba doesn't let you change the axes, can anyone recommend a third party object that does allow me more control over graphing? Cheap is good, free is better :-)
You don't actually need to be in Excel to use a spreadsheet control! :)
I should be back in the office shortly - I'll check my OWC code samples - I'm pretty sure it is possible to do what you want. Do you have the dates in an array already?
I should be back in the office shortly - I'll check my OWC code samples - I'm pretty sure it is possible to do what you want. Do you have the dates in an array already?
ASKER
Rorya - thanks for that, I appreciate the help. I have 2 arrays that I read from a database. One contains the dates for the x-axis and the other contains the y-values.
Assuming your chart variable is called cht and your date array is adteCategories, the code would be:
cht.SetData chDimCategories, chDataLiteral, adteCategories
I assume you know you could bind the chart to the database?
cht.SetData chDimCategories, chDataLiteral, adteCategories
I assume you know you could bind the chart to the database?
ASKER
Rorya - I can't get this to work. Do you have a code sample that you could post?
I don't want to bind to a database as there is some manipulation of the data before displaying.
I don't want to bind to a database as there is some manipulation of the data before displaying.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Rorya - my mistake was in not making the date array a variant array.
then look at the code and modify it to suit
there is no vba code to set the axis and cart labels dynamically