Page 1 of 1

Printing with Canvas text causes large print

Posted: Thu Apr 14, 2005 9:19 pm
by 9080335
I am using the Canvas TextOut functionality to output text to the TChart Canvas. I have set the canvas.font.height property. I have 2 basic modes that I use when displaying the plotted data. One mode uses custom axis for the vertical axis, the other mode uses the standard TChart.Axis.Left. When I print in the custom axis mode, the text that I have added to the canvas prints in the correct font height; when I print in the mode that displays and uses the Axis.Left, the font is oversized and extremely large. In my code, if I set theTChart1.Axis.Left.Visible = False, then the canvas text prints correctly; if I set the TChart1.Axis.Left.Visible = True, then the large font size is printed.

I had resolved earlier issues by setting the Canvas.Font.Height property, but that only seems to work if not displaying the TChart1.Axis.Left axis.

Thanks for your assistance,

Scott Small

Posted: Fri Apr 15, 2005 9:13 am
by narcis
Hi Scott,

It works fine here using TeeChart Pro v7.0.0.3 ActiveX.

I've posted an example project at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup. Could you please try if this works for you? Feel free to modify it so that we can reproduce the problem here.

Posted: Fri Apr 15, 2005 8:15 pm
by 9080335
Thanks Narcis for your response. I failed to identify that I am using the TeeChart Pro v6.0.0.4 ActiveX control within an HTML page. We have seen other issues when using the control within HTML pages and scripting, so not sure if this is a limitation in using HTML pages. This fact may change your response.

I have attempted a workaround, trying to use Annotation Shapes, but I run into issues within HTML and vbscripting when trying to access any of the objects underneath .Tools.Items(0).asAnnotation (such as .Text, or .Shape.Color). When accessing the asAnnotation object, I get an "unexpected call to method or property access. I get this directly after adding the annotation:

Code: Select all

		.Tools.Add 10   'tcAnnotate
		.Tools.Items(0).Active = True
		.Tools.Items(0).asAnnotation.Text = "HELLO"
When the same code is run in a VB project, everything works great. Again, any assistance you can provide will be appreciated.

Thanks,
Scott Small

Posted: Mon Apr 18, 2005 1:19 pm
by narcis
Hi scott,

I've been able to reproduce this using v6 ActiveX. However the code below works for me.

Code: Select all

	TChart1.Tools.Add 10
	TChart1.Tools.Items(0).Active = True
	TChart1.Tools.Items(0).asAnnotation.Position = ppLeftTop
	TChart1.Tools.Items(0).asAnnotation.Shape.ShapeStyle = fosRoundRectangle
	TChart1.Tools.Items(0).asAnnotation.Shape.Font.Color = vbCyan
	TChart1.Tools.Items(0).asAnnotation.Text = "Hello!"
I've seen that if using those instructions into a With statement fails while using the code above not.

Posted: Mon Apr 18, 2005 10:26 pm
by 9080335
Narcis,
thanks for your update. In reading your email, I understand it to mean that you have been able to recreate the canvas textout printing issue with the v6 ActiveX control, when hosting TChart in an HTML page and using scripting. Is there any workaround in the v6 ActiveX control to be able to display and print the canvas textout when the TChart1.Axis.Left.Visible is set to true?

I was able to duplicate the printing size issue for canvas textout in VB using the v6 ActiveX control.

As workaround I have continued to try to get the annotation shapes to work, but have been completely unsuccessful; I removed the With as you suggested, tried using the Set command, and tried putting the code in JScript. In VBScript, I continue to get errors when accessing any of the properties below the asAnnotation element (for example, TChart1.Tools.Item(0).asAnnotation.Text = "HELLO"); when in JScript, errors occur when setting the Active property (TChart1.Tools.Items[0].Active;).

Do you have any other ideas on how this issue can be resolved with the v6 ActiveX control?
Thanks,
Scott Small

Posted: Thu Apr 21, 2005 9:41 am
by Pep
Do you have any other ideas on how this issue can be resolved with the v6 ActiveX control?
To solve this make sure all custom objects ara placed relative to the Chart objects. Using the following code with TeeChart AX v6 (generating the EXE file) works fine here.

Code: Select all

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

Private Sub Form_Load()
With TChart1
    .Aspect.View3D = False
    .AddSeries scBar
    .Series(0).FillSampleValues (3)
End With
End Sub

Private Sub TChart1_OnAfterDraw()
TChart1.Canvas.Font.Height = TChart1.Axis.Bottom.Labels.Font.Height
TChart1.Canvas.TextOut TChart1.Axis.Bottom.CalcXPosValue(0), TChart1.Axis.Left.CalcYPosValue(0), "hello"
End Sub