chart SetVisible affects Annotation

TeeChart for ActiveX, COM and ASP
Post Reply
David
Advanced
Posts: 203
Joined: Tue Nov 08, 2005 5:00 am

chart SetVisible affects Annotation

Post by David » Tue Jul 09, 2013 5:47 am

I got two charts and I use chart.SetVisible to switch between the displays. I have both colorband and annotations on both charts and the chart that got initially displayed can show the Annotations correctly, but when I switch between the two charts, all Annotations were gone. Would any please suggest how to solve this problem? Below are the codes I used.

Both charts have colorband and annotations.

Code: Select all

	m_chart2.GetTools().Add(tcColorband);
	m_chart2.GetTools().Add(tcColorband);
	m_chart2.GetTools().GetItems(0).GetAsColorband().SetStartValue(0.5);
	m_chart2.GetTools().GetItems(0).GetAsColorband().SetEndValue(6.0);
	m_chart2.GetTools().GetItems(0).GetAsColorband().SetColor(LIGHTYELLOW);
	m_chart2.GetTools().GetItems(0).GetAsColorband().SetTransparency(95);
	m_chart2.GetTools().GetItems(0).GetAsColorband().SetAxis(v);
	m_chart2.GetTools().GetItems(0).SetActive(TRUE);

	m_chart2.GetTools().GetItems(1).GetAsColorband().SetStartValue(12);
	m_chart2.GetTools().GetItems(1).GetAsColorband().SetEndValue(18);
	m_chart2.GetTools().GetItems(1).GetAsColorband().SetColor(LIGHTBLUE);
	m_chart2.GetTools().GetItems(1).GetAsColorband().SetTransparency(95);
	m_chart2.GetTools().GetItems(1).GetAsColorband().SetAxis(v);
	m_chart2.GetTools().GetItems(1).SetActive(TRUE);

	m_chart2.GetTools().Add(tcAnnotate);
	m_chart2.GetTools().GetItems(2).GetAsAnnotation().SetPositionUnits(puPercent);
	m_chart2.GetTools().GetItems(2).GetAsAnnotation().SetLeft(15);
	m_chart2.GetTools().GetItems(2).GetAsAnnotation().SetTop(10);
	m_chart2.GetTools().GetItems(2).GetAsAnnotation().SetText(_T("VCi"));

	m_chart2.GetTools().Add(tcAnnotate);
	m_chart2.GetTools().GetItems(3).GetAsAnnotation().SetPositionUnits(puPercent);
	m_chart2.GetTools().GetItems(3).GetAsAnnotation().SetLeft(45);
	m_chart2.GetTools().GetItems(3).GetAsAnnotation().SetTop(10);
	m_chart2.GetTools().GetItems(3).GetAsAnnotation().SetText(_T("VAi"));
This is how I switch the display.

Code: Select all

	m_chart1.SetVisible(TRUE);
	m_chart2.SetVisible(FALSE);

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

Re: chart SetVisible affects Annotation

Post by Yeray » Tue Jul 09, 2013 10:13 am

Hi,

Try using

Code: Select all

SetPositionUnits(puPixels);
And then positioning the annotation with absolute values in pixels. With puPercent the annotations positions are recalculated at each repaint
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