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);
Annotation position when exporting to jpg or printed
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hi --
The following code (TeeChart Pro AXv6.0.0.4) works correctly here:Position of annotations is wrong on the exported image or printed output.
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/
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/
Thnaks: Now if only !
Now if only there have been complete VC++ documenatation for TeeChartI may have seen the OnBeforeDraw()
hansw
hansw