DrawLine problem

TeeChart for ActiveX, COM and ASP
Post Reply
roger
Newbie
Newbie
Posts: 26
Joined: Thu May 10, 2007 12:00 am

DrawLine problem

Post by roger » Mon Oct 25, 2010 9:43 am

Hello,
I am now trying with Teechart ActiveX Pro 8 version and seems that the older problems are resolved.
But now when i am using the code to drawline which was perfectly drawing lines in version 7 seems to have some problem in version 8.

I am using following code

Code: Select all

	CPen1 penMass1 = m_canvas[nChartIndx].GetPen();
	penMass1.SetColor(PEN_COLOR_RED);
	penMass1.SetStyle(psSolid);

	Y0 = m_graph[nChartIndx].GetAxis().GetTop().GetPosition();
	Y1 = m_graph[nChartIndx].GetAxis().GetBottom().GetPosition();
	m_canvas[nChartIndx].DrawLine(X0, Y0, X1, Y1);

	// drawing line intersecting Y axis
	penMass1.SetColor(PEN_COLOR_BLACK);
	penMass1.SetStyle(psDash);

	long YMid = (Y1 + Y0) / 2;
	X0 = m_axisLeft[nChartIndx].GetPosition();
	X1 = m_axisRight[nChartIndx].GetPosition();
	X1 = m_graph[nChartIndx].GetAxis().GetRight().GetIStartPos();
	m_canvas[nChartIndx].DrawLine(X0, YMid, X1, YMid);
To draw an vertical and horizontal line but

it is not drawing the horizontal line properly,. Would you please help me??


Thanks in advance.
Attachments
graph.JPG
Horizontal line not drawn
graph.JPG (10.52 KiB) Viewed 4189 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: DrawLine problem

Post by Narcís » Mon Oct 25, 2010 11:36 am

Hi roger,

I'm afraid some code is missing here to be able to reproduce the problem. Anyway, code snippet below works fine for us here. Does it works fine at your end? Can you please attach a simple example project we can run "as-is" to reproduce the problem here?

Code: Select all

void CV8ExampleDlg::OnOnAfterDrawTchart1() 
{
	int X0 = m_Chart1.GetAxis().GetBottom().GetIStartPos();
	int X1 = m_Chart1.GetAxis().GetBottom().GetIEndPos();
	int Y0 = X0 + ((X1 - X0) / 2);
	int Y1 = Y0;
	
	m_Chart1.GetCanvas().GetPen().SetColor(RGB(255,0,0));
	m_Chart1.GetCanvas().DrawLine(X0, Y0, X1, Y1);

	Y0 = m_Chart1.GetAxis().GetLeft().GetIStartPos();
	Y1 = m_Chart1.GetAxis().GetLeft().GetIEndPos();
	X0 = Y0 + ((Y1 - Y0) / 2);
	X1 = X0;

	m_Chart1.GetCanvas().DrawLine(X0, Y0, X1, Y1);
}
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply