Polygon drawing issue

TeeChart for ActiveX, COM and ASP
Post Reply
Bhanu
Newbie
Newbie
Posts: 16
Joined: Thu May 31, 2018 12:00 am

Polygon drawing issue

Post by Bhanu » Mon Jun 04, 2018 1:20 pm

demo-001.jpg
demo-001.jpg (204.86 KiB) Viewed 1585 times
demo-002.jpg
demo-002.jpg (144.14 KiB) Viewed 1585 times
Hi,

We have recently migrated to the latest version of T-Chart i.e. ActiveX 2018. But after migration we are facing difficulty in polygon drawing on canvas which was working fine earlier. Polygon drawing on canvas while working on line-series is working fine. But while drawing polygon, if we mouse hover or click on bubble series then polygon disappears which is not the desired behavior. Interestingly on line-series there is no issue on canvas drawing but the issue is coming on bubble series.

Kindly suggest the code or teechart editor setting so that polygon do not disappear on bubble click or bubble mouse hover.

Regards,
Bhanu

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

Re: Polygon drawing issue

Post by Yeray » Tue Jun 05, 2018 9:22 am

Hello Bhanu,

I can't find any test application attached but, according to your description, the problem may disappear as soon as you disable the Hover feature by code or at design time:

- By code:

Code: Select all

    TChart1.Hover.Visible = False
- At design time:
VB6_2016-05-30_10-45-03.png
VB6_2016-05-30_10-45-03.png (11.51 KiB) Viewed 1579 times
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

Bhanu
Newbie
Newbie
Posts: 16
Joined: Thu May 31, 2018 12:00 am

Re: Polygon drawing issue

Post by Bhanu » Tue Jun 05, 2018 10:37 am

Demo.7z
(62.59 KiB) Downloaded 114 times
Hi Yeray,

Thanks for your response. Based on your suggestion we did tried to toggle off the hover settings, but issue still persists. For reference I am attaching code as well as demo application. We would request you to kindly guide us.

Thanks
Bhanu


These are my default settings in code:

Code: Select all

//.......gdi and hover settings........

m_chart.GetAspect().GetGDIPlus().SetActive(FALSE);
m_chart.GetHover().SetVisible(false);

m_chart.Series(0).GetSelected().GetHover().SetVisible(false); 
m_chart.Series(1).GetSelected().GetHover().SetVisible(false);
	
for (int i = 0; i < 10; i++)
{
	m_chart.Series(0).GetAsBubble().AddBubble(20*i, i,3, (LPCTSTR)"", RGB(255, 255, 0));
}

for (int i = 0; i < 100; i++)
{
	m_chart.Series(1).AddXY(i, i, (LPCTSTR)"", RGB(0, 0, 0));
}

Polygon drawing code:
void CDemoDlg::OnMouseDownTchart1(long Button, long Shift, long X, long Y)
{	
	if (IsStartDrawing == true)
	{
		if (Button == 1)
		{
			if (startX == -1 && startY == -1)
			{
				startX = X;
				startY = Y;
				return;
			}

			if (endX == -1 && endY == -1)
			{
				endX = X;
				endY = Y;
			}

			if (endX != -1 && endY != -1 && startX != -1 && startY != -1)
			{
				m_chart.GetCanvas().DrawLine(startX, startY, endX, endY);		

				startX = endX;
				startY = endY;

				endX = -1;
				endY = -1;
			}
		}
	}
}

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

Re: Polygon drawing issue

Post by Yeray » Mon Jun 11, 2018 7:22 am

Hello,

I'm not sure how the chart is being repainted when you move the mouse over the bubbles. I've exported your chart to a .tee, imported it into a delphi application (note TeeChart ActiveX is a wrapper from the VCL version), added your code at OnMouseDown event and it seems to work fine; without loosing the lines you are manually drawing.

An alternative would be to store your lines start and end points to an array and draw this array at the Chart OnAfterDraw event. This way, if the chart is repainted, the lines will also be repainted.
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

Bhanu
Newbie
Newbie
Posts: 16
Joined: Thu May 31, 2018 12:00 am

Re: Polygon drawing issue

Post by Bhanu » Tue Jun 12, 2018 11:35 am

Thanks a lot. This resolves the issue.

Post Reply