Page 1 of 1
Strange behaviour of a TeeChart in a Tabcontrol
Posted: Sat Mar 05, 2005 11:20 am
by 9523802
Hi all!
Simply create a tabcontrol and two tabpages. Place on each page a Tchart and create some data. After starting the form, ask for the .Axes.Bottom.IAxisSize of the second chart. It's zero! In a different thread I've dicussed this behaviour and asked for some information how to bypass. I don't know how many additional properties of the Chart show this behaviour? (question to Steema?)
The same behaviour I encountered while making a picture of the second chart using the streaming method. The stream fails as long as the tabpage is clicked and the second chart is shown. Same like described above.
How to fix this behaviour (except for rotation through the tappages before streaming/printing/asking for values)?
The main problem seems to be: drawing on a chart in the background (or on a tabpage in the background).
My question: can Steema fix this behaviour? Very Urgent!
Thanks in advance
Alex
Posted: Mon Mar 07, 2005 10:16 am
by narcis
Hi Alex,
Simply create a tabcontrol and two tabpages. Place on each page a Tchart and create some data. After starting the form, ask for the .Axes.Bottom.IAxisSize of the second chart. It's zero! In a different thread I've dicussed this behaviour and asked for some information how to bypass. I don't know how many additional properties of the Chart show this behaviour? (question to Steema?)
I've been able to reproduce the behaviour you report. This happens because the value is not updated until the chart is drawn. If you read it on AfterDraw event it will be correct.
The same behaviour I encountered while making a picture of the second chart using the streaming method. The stream fails as long as the tabpage is clicked and the second chart is shown. Same like described above.
Could you please post an example we can run "as-is" in the newsgroups to reproduce the problem here?
Posted: Thu Mar 10, 2005 2:44 pm
by 9523802
Hi Narcis,
that's the problem. Is there a way to manually force a "Draw" without displaying the chart by clicking the tabpage? (e.g. TChart1.DrawSeries ???).
The problem is, I cannot circle through all charts of the whole app and display... (after placing some series to the charts).
I've posted an example project using the tabcontrol and the streaming... Please have a look, I think it's the same problem that there is no "Draw" made even though something on the Chart has changed.
Maybe the "Draw" can be forced? (in the background?) I think then all this problems will disappear.
Thanks in advance!
Best regards
Alex
Posted: Thu Mar 10, 2005 3:12 pm
by Chris
Hi Alex,
Thank you for posting an example.
Looking at your code, I can't see why you can't use the techniques outlined in the TeeChart Pro .NET Tutorials under Tutorial 14 - Printing Charts -> Extended Printing methods.
If you would rather work with Print Documents, please see:
http://tinyurl.com/49kes
Posted: Thu Mar 10, 2005 6:23 pm
by 9523802
Hi Chris,
thanks for your mention. Narcis asked for a short example project, which I have posted. Printing multiple charts on multiple pages is only possible via streaming to an image. Please see the past postings and topics concerning this problem (Pep, Narcis).
Thanks for your hint, it's not useable.
A) Why the example project will not work?
B) How to force an update to a chart without displaying it on top?
Other trivial solutions, e.g. "look in the tutorial" are not requested.
Thanks
Alex
Posted: Thu Mar 10, 2005 7:36 pm
by Chris
Hi Alex,
thanks for your mention. Narcis asked for a short example project, which I have posted.
Yes, the one I was referring to when I said "Looking at your code" in my last post.
Printing multiple charts on multiple pages is only possible via streaming to an image.
What does this mean, exactly? You can print multiple charts to a printer without streaming them individually to bitmaps using the techniques outlined in the Tutorials I mentioned. You can also print charts to PrintDocuments which you can then print individually or multiply, as you wish.
Other trivial solutions, e.g. "look in the tutorial" are not requested.
Have you looked in the Tutorials as I suggested? What is it, exactly, that you are trying to achieve? Four charts on one piece of printed paper? Six printed charts, three on each of two pieces of paper? Until you give us a clear idea of what you want to achieve I'm afraid we are not going to either be able to help you or be able to make the relevant changes, if necessary, to the source code.
Posted: Fri Mar 11, 2005 8:33 am
by Chris
Hi Alex,
One possible solution to your problem maybe the following:
Code: Select all
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim printdocument1 As Printing.PrintDocument
'using trivial techniques readily available in the tutorials and FAQ:
TChart1.Printer.BeginPrint()
TChart1.Printer.Print(TChart2.Chart, New Rectangle(10, 300, TChart2.Width, TChart2.Height))
TChart1.Printer.Print(New Rectangle(10, 10, TChart1.Width, TChart1.Height))
printdocument1 = TChart1.Printer.PrintDocument
Dim test As New PrintPreviewDialog
With test
.Document = printdocument1
.ShowDialog()
End With
End Sub
Posted: Fri Mar 11, 2005 8:48 am
by 9523802
Hi Chris,
Yes, the one I was referring to when I said "Looking at your code" in my last post.
Please have a look into the topic "Printing AX-V7 in .NET using the PrintDocument???" in the Ax-Forum. There is the history...
What does this mean, exactly? You can print multiple charts to a printer without streaming them individually to bitmaps using the techniques outlined in the Tutorials I mentioned.
Maybe I am to stupid to recognize how to do?
How to make a manual page break using the Tchart.Printer? How to add custom graphics to the print document related to the current page? Please refer to Pep and Narcis about the solution via streaming...
(Original idea: use standard .NET printing methods -> stream the chart to an image -> place to the print document related the page using e.hasmorepages). Maybe you're now the right person to solve this problems?
Six printed charts, three on each of two pieces of paper?
Yes, something in this way. Additional the Charts are placed in a tabcontrol. I won't display all charts before printing. (refer to IAxis problem and streaming problem, thats the reason why this thread exists. Not only for fun.
)
Until you give us a clear idea of what you want to achieve I'm afraid we are not going to either be able to help you or be able to make the relevant changes, if necessary, to the source code.
I think that's the moment where I should ask you, if I maybe have misunderstood your posting? That's right, or isn't it?
Of course, in the way you write I have to think you have a little problem with me or my questions? I would propose to ask your collegues or read my postings. I don't know what you want to hear? Precise descriptions on the problems were done in the past.
By the way, thanks to Pep and Narcis for their excellent help in the past.
Best regards
Alex
Posted: Fri Mar 11, 2005 9:09 am
by Chris
Hi Alex,
How about starting from the code example I posted a few minutes ago, i.e.
Code: Select all
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim printdocument1 As Printing.PrintDocument
TChart1.Printer.BeginPrint()
TChart1.Printer.Print(TChart2.Chart, New Rectangle(10, 300, TChart2.Width, TChart2.Height))
TChart1.Printer.Print(New Rectangle(10, 10, TChart1.Width, TChart1.Height))
printdocument1 = TChart1.Printer.PrintDocument
Dim test As New PrintPreviewDialog
With test
.Document = printdocument1
.ShowDialog()
End With
End Sub
Would you be so kind as to tell me if this solves the problem of printing two teecharts, one of which hidden in a tabpage, to a printdocument and then displaying this printdocument in a standard PrintPreviewDialog? This is what I see as the functionality of the code you posted to the attachments newsgroup.
What else do you need to do? If you need to add non-teechart information to the printdocument then you can further use the techniques outlined in the tutorials. You should be able to add page breaks using native .net methodologies.
I really am trying to help you solve your issues here and I'm sorry for any misunderstandings that may have arisen during our communication so far.
Posted: Fri Mar 11, 2005 9:19 am
by 9523802
Hi Chris,
thanks for the code. Ok, lets start using this code.
Two questions:
- How can I add a page break between chart1 and chart2?
- How can I change the aspect ratio of both charts related to their IAxisSize? (Reason: manually isometric scaling of the charts, that means I ask for the pixel size of the chart and adjust my bottom/left axis borders to get isometric scaling). If the TChart is placed in a tabcontrol (background) the IAxisSize is not available until the chart is displayed.
Thanks.
Alex
Posted: Fri Mar 11, 2005 11:26 am
by Chris
Hi Alex,
- How can I add a page break between chart1 and chart2?
I'm not sure entirely what you mean here .. do you mean that you'd like the charts to appear as two separate pages in the print preview? This being so then my best suggestion is to print the charts as two separate printdocuments and then somehow add them to the print preview as two separate pages.
- How can I change the aspect ratio of both charts related to their IAxisSize? (Reason: manually isometric scaling of the charts, that means I ask for the pixel size of the chart and adjust my bottom/left axis borders to get isometric scaling). If the TChart is placed in a tabcontrol (background) the IAxisSize is not available until the chart is displayed.
It's not necessary .. I've just posted an example of how to make a chart's axis isometric, in the context of your example, to the steema.public.attachments newsgroup.
Posted: Thu Mar 17, 2005 4:49 pm
by 9523802
Hi Chris,
thanks for your posting and the code example! The trick for internal redrawing the chart is excellent!
That's what I looked for... (so I can solve the IAxis and streaming behaviour without problems...)
Thanks for your fast answers!
Best regards
Alex