Annotation position when exporting to jpg or printed

TeeChart for ActiveX, COM and ASP
Post Reply
hansw
Newbie
Newbie
Posts: 59
Joined: Fri Nov 15, 2002 12:00 am

Annotation position when exporting to jpg or printed

Post by hansw » Wed Dec 31, 2003 4:46 pm

Position of annotations is wrong on the exported image or printed output.

Chris suggested to use (see previous post)
m_Chart1.Series(0).CalcXPos() and m_Chart1.Series(0).CalcYPos().

I am already doing that.

Print preview displays the annotations in the correct place, the printed output is wrong.


int X = (int)m_Chart1.Series(0).CalcXPos( myX );

m_Chart1.GetTools().GetItems( 0 .GetAsAnnotation().GetShape().SetLeft(X);

int Y = (int)m_Chart1.Series(0).CalcXPos( myY );

m_Chart1.GetTools().GetItems( 0 .GetAsAnnotation().GetShape().SetTop(Y);

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Fri Jan 02, 2004 11:38 am

Hi --
Position of annotations is wrong on the exported image or printed output.
The following code (TeeChart Pro AXv6.0.0.4) works correctly here:

Code: Select all

void CVCplus6AXv6Dlg::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	
    m_Chart1.AddSeries(scLine);
    m_Chart1.Series(0).FillSampleValues(20);
    m_Chart1.GetTools().Add(tcAnnotate);
    m_Chart1.GetTools().GetItems(0).GetAsAnnotation().SetText("Hi");
    m_Chart1.GetTools().GetItems(0).GetAsAnnotation().GetShape().SetCustomPosition(true);
}

void CVCplus6AXv6Dlg::OnButton1() 
{
	m_Chart1.GetExport().GetAsJPEG().SaveToFile("C:\\TEMP\\anno2.jpg");  	
}


void CVCplus6AXv6Dlg::OnOnBeforeDrawSeriesTchart1() 
{
    m_Chart1.GetTools().GetItems(0).GetAsAnnotation().GetShape().SetLeft(m_Chart1.Series(0).CalcXPos(10));
	m_Chart1.GetTools().GetItems(0).GetAsAnnotation().GetShape().SetTop(m_Chart1.Series(0).CalcYPos(10));
}
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

hansw
Newbie
Newbie
Posts: 59
Joined: Fri Nov 15, 2002 12:00 am

Thnaks: Now if only !

Post by hansw » Fri Jan 02, 2004 2:15 pm

Now if only there have been complete VC++ documenatation for TeeChartI may have seen the OnBeforeDraw() :wink:
hansw

Post Reply