Chart::DrawLine?

TeeChart for ActiveX, COM and ASP
Post Reply
PaulaT
Newbie
Newbie
Posts: 8
Joined: Fri Jul 11, 2008 12:00 am

Chart::DrawLine?

Post by PaulaT » Wed Mar 10, 2010 4:32 pm

Hello,

I am completely new to TeeChart and am attempting to add a vertical line using Chart::DrawLine() in a Visual C++ application compiled under Visual Studio 2008. Sample code appears below.

The series that I've added to the chart plots just fine, but I can't get the lines to appear at all. Breakpoints show my OnAfterDraw() routine is getting called. Any thoughts?

Thanks for your help...

- Ted

Code: Select all

	private: System::Void MyChart_OnAfterDraw(System::Object^  sender, System::EventArgs^  e)
			{
				int middle = (chart->Axis->Bottom->StartPosition + chart->Axis->Bottom->EndPosition) / 2;
				chart->Canvas->DrawLine(middle, chart->Axis->Left->StartPosition, middle, chart->Axis->Left->EndPosition);
				chart->Canvas->DrawLine(10, 22, 16, 45);
			}


Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Chart::DrawLine?

Post by Yeray » Thu Mar 11, 2010 4:05 pm

Hi Ted,

Try the IStartPos and IEndPos instead of StartPosition and EndPosition (the seconds are percentages).

Code: Select all

int middle = (axTChart1->Axis->Bottom->IStartPos + axTChart1->Axis->Bottom->IEndPos) / 2;
axTChart1->Canvas->DrawLine(middle, axTChart1->Axis->Left->IStartPos, middle, axTChart1->Axis->Left->IEndPos);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply