Page 1 of 1

Problem with adding custom axis...

Posted: Wed Jan 12, 2005 12:22 am
by 9525524
Hello.

I need to draw a marix plot. Matrix plot must have many axes and I use the method, AddCustom() of CAxes class. When I add just one custom axis, TChart works. But, I add two or more custom axes and then custom axis index error occurs.

The codes that I use follows:

long lYAxis;

lYAxis = m_pChart->GetAxis().AddCustom(FALSE);
m_pChart->GetAxis().GetCustom(lYAxis).SetStartPosition(1);
m_pChart->GetAxis().GetCustom(lYAxis).SetEndPosition(60);
m_pChart->GetAxis().GetCustom(lYAxis).GetTitle().SetAngle(90);

lYAxis = m_pChart->GetAxis().AddCustom(FALSE); // Not error at this time
m_pChart->GetAxis().GetCustom(lYAxis).SetStartPosition(70);
m_pChart->GetAxis().GetCustom(lYAxis).SetEndPosition(99);
m_pChart->GetAxis().GetCustom(lYAxis).GetTitle().SetAngle(90);

.......

m_pChart->GetExport().SaveToFile(szFileName); -> Custom Axis Index Error occurs.


I use TeeChart ActiveX ver 7.0

Please tell me the solution.
thanks.

Posted: Wed Jan 12, 2005 6:17 pm
by Pep
Hi,

I'm not able to reproduce the problem here using the latest v7.03. I've posted an example into the steema.public.attachments newsgroup (with the same subject). Could you please download it and test if it works fine for you ?

Posted: Wed Jan 12, 2005 11:58 pm
by 9525524
Hi,

I can not find the article in the news group.
Check it please.

Posted: Thu Jan 13, 2005 9:46 am
by narcis
Hi TurboK,

The message is certainly in the newsgroups steema.public.attachments.

You can access our public newsgroups using a newsreader and configuring news:\\www.steema.net.

Posted: Fri Jan 14, 2005 1:05 am
by 9525524
Hi Narcis )

I found the article.

Thanks for helping. :D

Posted: Fri Jan 14, 2005 2:31 am
by 9525524
Hi Pep,

I got the source that you post. I ran it and there was no errors.
I inspected my source for finding the differences between two sources and I found the difference, m_chart.GetAxis().RemoveAllCustom() !!

If there is the different code, " m_chart.GetExport().SaveToFile("c:\data.tee") " makes a error.


m_chart.RemoveAllSeries();

long lCustomAxisCount = m_chart.GetAxis().GetCustomCount(); // It retuens 1. I do not add any custom axis. Why 1??
m_chart.GetAxis().RemoveAllCustom(); // This code makes the error that I said.

m_chart.AddSeries(0);
m_chart.AddSeries(0);

m_chart.Series(0).FillSampleValues(10);
m_chart.Series(1).FillSampleValues(10);


long lYAxis;

lYAxis = m_chart.GetAxis().AddCustom(false);
m_chart.GetAxis().GetCustom(lYAxis).SetStartPosition(1);
m_chart.GetAxis().GetCustom(lYAxis).SetEndPosition(60);
m_chart.GetAxis().GetCustom(lYAxis).GetTitle().SetAngle(90);
m_chart.Series(0).SetVerticalAxisCustom(lYAxis);

lYAxis = m_chart.GetAxis().AddCustom(false); // Not error at this time
m_chart.GetAxis().GetCustom(lYAxis).SetStartPosition(70);
m_chart.GetAxis().GetCustom(lYAxis).SetEndPosition(99);
m_chart.GetAxis().GetCustom(lYAxis).GetTitle().SetAngle(90);
m_chart.Series(1).SetVerticalAxisCustom(lYAxis);

m_chart.GetExport().SaveToFile("c:\data.tee"); -> Error occurs.

Please Check it.

Thanks.

Posted: Fri Jan 21, 2005 11:58 am
by Pep
Hi,

checked. Yes the difference is the RemoveAllCustom() call.
long lCustomAxisCount = m_chart.GetAxis().GetCustomCount(); // It retuens 1. I do not add any custom axis. Why 1??
Yes, you're correct, it's a known problem already down our deffect list. We'll review and try to fix if for the next maintenance release. In meantime you can remove this line which will make it work fine , also if you need to refer to any of the CustomAxis using the index, remember to increment by 1 the index.