Page 1 of 1

Annotation position when exporting to jpg or printed

Posted: Wed Dec 31, 2003 4:46 pm
by 9078641
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);

Posted: Fri Jan 02, 2004 11:38 am
by Chris
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));
}

Thnaks: Now if only !

Posted: Fri Jan 02, 2004 2:15 pm
by 9078641
Now if only there have been complete VC++ documenatation for TeeChartI may have seen the OnBeforeDraw() :wink:
hansw