Hi,
I have a problem with the print function. We use the internal functions to modify the chart during runtime for our users. We also use the internal function to print.
If I have an annotation object over the axis and a legend on a common line chart and try to print the the chart the legend and annotation is missing compleatly.
If I use the print preview feature and resize the chart to cover the complete page the objects prints perfectly.
I user the Windows XP theme on all charts and the ActiveX version of TeeChart 7.0
Best Regards
Daniel Larsson
Sweden
Problem with printing (Legend and annotation)
Hi Daniel,
the problem is that all custom positioned object (rectangles, text, series marks) use screen pixels as coordinates. While this is fine for the screen it does not work for a printer. The reason is that when you print, TeeChart will internally change the chart size so that it fits in specified printer. Canvas region. The result is that the Chart size will change but the custom positioned items "positions" on the printer canvas will remain the same (in screen pixel coordinates). This will result in custom items being drawn in the wrong place.
To solve this :
1. Make sure these objects are all placed relative to non-Canvas TChart objects (Axes, Headers, Series Points etc.) rather than in absolute pixel values.
2. To see this work please create an .exe file from your VB project and print from there.
A simple example printing custom Annotation tools could be the following :
Code:
the problem is that all custom positioned object (rectangles, text, series marks) use screen pixels as coordinates. While this is fine for the screen it does not work for a printer. The reason is that when you print, TeeChart will internally change the chart size so that it fits in specified printer. Canvas region. The result is that the Chart size will change but the custom positioned items "positions" on the printer canvas will remain the same (in screen pixel coordinates). This will result in custom items being drawn in the wrong place.
To solve this :
1. Make sure these objects are all placed relative to non-Canvas TChart objects (Axes, Headers, Series Points etc.) rather than in absolute pixel values.
2. To see this work please create an .exe file from your VB project and print from there.
A simple example printing custom Annotation tools could be the following :
Code:
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
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi Daniel,
in that case I think the only solution could be to reposition them in the OnBeforePrint event.
in that case I think the only solution could be to reposition them in the OnBeforePrint event.
Pep Jorge
http://support.steema.com
http://support.steema.com