still having annotation printing problems

TeeChart for ActiveX, COM and ASP
Post Reply
Duane
Newbie
Newbie
Posts: 9
Joined: Tue Feb 17, 2004 5:00 am
Location: Houston, TX

still having annotation printing problems

Post by Duane » Wed Apr 14, 2004 8:03 pm

i put the calcxpos & calcypos calls in OnBeforeDrawSeries, used the results to Move the annotaions, the Print Preview shows the annotations and callouts correctly positioned but the printout prints them offset, looks like about consistently -300pixels in the x and -300 pixels in the y (- to the Left & Top).......I checked the event, the OnBeforeDrawSeries event is only fired AFTER the print job is spooled and actually over. So this does help move the annotation but only with respect to the screen, not the printer.......

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Apr 15, 2004 7:07 am

Hi,

in order for the Annotation Tools to print in the correct position you have to define their positions relative to other TeeChart objects and not as absolute pixel positions. Unfortunately the default positions are absolute pixel positions and so can't be used to print Charts - if you want to print an Annotation Tool in the ppLeftTop position, for example, you'll have to use code similar to the following (to see this work please create an .exe file from your VB project and print from there):

Code: Select all

Private Sub Command1_Click()
TChart1.Printer.ShowPreview
End Sub

Private Sub Form_Load()
With TChart1
    .AddSeries scLine
    .Series(0).FillSampleValues 10
    .Tools.Add tcAnnotate
    With .Tools.Items(0).asAnnotation
        .Text = "HELLO"
    End With
End With
End Sub

Private Sub TChart1_OnBeforeDrawSeries()
With TChart1
    With .Tools.Items(0).asAnnotation
        .Shape.CustomPosition = True
        .Shape.Left = TChart1.Axis.Left.Position - 30
        .Shape.Top = TChart1.Axis.Top.Position - 30
    End With
End With
End Sub

Post Reply