Page 1 of 1

X and Y Axis Labels

Posted: Thu Oct 18, 2007 3:05 pm
by 15046346
I programing in C++ using Visual Studio 2005 using TeeChart Pro Activex v8. I need to be able to lable the X and Y axis. For instance the Y axis is showing "Savings - kWh per kW of Lighting" and the X axis is showing "Climate Zone". So, I want the label for the Y axis to run up the left side of the graph, left of the tick labels, and the label for the X axis to run along the bottom of the graph, just under the tick labels.

Since this is VC 2005 C++ and I am using your activex control I think I have to use LPDISPATCH to access anything (most irritating, by the way).

Given this how do I get the X and Y axis labels to show up?

Thanks,

Al

Posted: Thu Oct 18, 2007 3:11 pm
by narcis
Hi Al,

Sorry but it's not clear to me what you are trying to achieve. Could you please give us some more details about you request? Is a title for each axis what are you trying to draw or a label for each data point?

Thanks in advance!

Posted: Thu Oct 18, 2007 3:13 pm
by 15046346
A title for each axis what are you trying to draw NOT the data points.

Posted: Thu Oct 18, 2007 3:38 pm
by 15046346
I am executing the following code:

LPDISPATCH lpdAxis = m_teeChart.get_Axis();
CAxis *m_Axis = new CAxis(lpdAxis);
CAxisLabels m_AxisLabels = m_Axis->GetLabels();

m_Axis->GetLabels() in axis.cpp makes a call to:

InvokeHelper(0xb, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, NULL);

which returns a "Member not found." error.

So, what is the problem here?

Posted: Mon Oct 22, 2007 1:29 pm
by Pep
Hi,

in that case, if what you're trying to add is a titles for the axis, using similar code to the following should do the trick :


LPDISPATCH lpdAxis = m_teeChart.get_Axis();
CAxis *m_Axis = new CAxis(lpdAxis);

m_Axis->GetLeft()->GetTitle()->SetCaption("your axis title");
and for bottom axis :
m_Axis->GetBottom()->GetTitle()->SetCaption("your axis title");

Posted: Mon Oct 22, 2007 3:16 pm
by 15046346
Well, that brings me back to this post:

http://www.teechart.net/support/viewtop ... 6241#26241

If I create a brand new project in Visual Studio 2005 for C++, I cannot access m_Axis->GetLeft() let alone the rest of the line. If my project had been converted from a VS6 project, then I can access those functions.

I would like to request you create a new VS2005 C++ example project, add the TeeChart Pro Chart ActiveX control and then demonstrate adding the left and bottom title captions.

Thanks,

Al

Posted: Mon Oct 22, 2007 3:19 pm
by narcis
Hi Al,

Are you obtaining any error message? You may need to check what's in the include section.

Thanks in advance.

Posted: Mon Oct 22, 2007 3:31 pm
by 15046346
If you will read through this thread and the other thread referenced you will begin to see what my concern is.

I would like to request you create a new VS2005 C++ example project, add the TeeChart Pro Chart ActiveX control and then demonstrate adding the left and bottom title captions.

Posted: Fri Oct 26, 2007 9:47 am
by narcis
Hello arice,

I have arranged and sent you a simple example from scratch using VS2005 C++ Windows Forms and TeeChart Pro v8 ActiveX. It sets axes titles as you requested. Windows Forms applications may be the easiest way to use ActiveX controls in VS2005 and doesn't need this cumbersome syntax. If you need to use another kind of applications please let us know and we will try to arrange an example project.

Posted: Fri Oct 26, 2007 12:58 pm
by 15046346
Thank you for the example. I've never used WinForms before. My programming has always been in straight C++ with MFC. By the way I did finally manage to get the axis labels working by first creating a TeeChart ActiveX project in VS6 and generating the wrapper classes. Then I create my project in VS 2005 C++, copy over the wrapper classes from the VS 6 project and everything works.

The problem for me was that when adding the ActiveX control to a VS 2005 project, VS 2005 does not generate the wrapper classes for me, however doing the same in VS 6 the wrapper classes are being generated.

I don't like it, but that certainly isn't Steema's fault.

If you see something wrong in the way I create a CS 2005 C++ project, I'd sure like some input.

Thanks,

Al

Posted: Tue Oct 30, 2007 4:59 pm
by Pep
Hi Al,

ok, I glad to hear that you solved it. I'm not very familiar with VC++2005. As you said, I'm not sure why the wrapper classes are not generated automatically as VS6, maybe some steps are required to do it, which I don't know. I've also seen some posts about this on other newsgroups.