Chart Templating

TeeChart for ActiveX, COM and ASP
Post Reply
GWRI
Newbie
Newbie
Posts: 7
Joined: Wed Apr 02, 2003 5:00 am
Location: USA
Contact:

Chart Templating

Post by GWRI » Mon Jul 12, 2004 8:38 pm

I have implemented Tee chart as one of the features in a VB6 based interface. It's working great, but now I'd like to enhance it by adding an ability to template charts. That is, I'd like to be able to store all the properties of the chart including title, axis label formats, axis titles, etc. in some sort of file that can be called on to format the chart later. I don't want to store the actual data, or even any indication of the number of series. I just want to store the formatting.

I've tried to use the export/import of the .tee chart file, but this seems to only work if you have data series already in the chart and you only intend those series to be in the chart. In my case, the user is actually controlling how many series will be added to the chart and what their format will be. I want to store this format so that when they look at the chart later (which may now have different data in it), their chosen formatting is preserved.

Perhaps I am using the .tee file incorrectly, but I am under the impression that this is not possible. Is this true?

Steve

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Tue Jul 13, 2004 7:20 am

Hi,
Perhaps I am using the .tee file incorrectly, but I am under the impression that this is not possible. Is this true?
No, it is possible. Have you seen the VB6.0 example under:
C:\Program Files\Steema Software\TeeChart Pro v6 ActiveX Control\Examples\Visual Basic\Visual Basic 5 & 6\Database BLOBs ?

The INativeExport.SaveToStream method (see Help for details) takes a IncludeData boolean parameter which allows you to specify whether or not data is saved to the TEE file.
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/

GWRI
Newbie
Newbie
Posts: 7
Joined: Wed Apr 02, 2003 5:00 am
Location: USA
Contact:

Post by GWRI » Tue Jul 13, 2004 8:48 pm

Thanks for your reply. I checked out the loadfromstream and loadfromfile methods, but I don't think this is what I want. What I want is the following:

1. In one VB form, have an Editor Panel (without any visible associated chart). In this panel, the user can enter non-series specific chart attributes like main titles, axis formats, etc.. Also, with perhaps a single dummy series, the user can enter the format of the series that will be added to the chart at a later time.

2. When the series are added to the chart, the formatting saved previously with the Editor panel is applied to them, along with the formatting for the non-series specific attributes.

I don't think this is what the VB example is doing. Is it?

Steve

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Wed Jul 14, 2004 8:01 am

Hi --
1. In one VB form, have an Editor Panel (without any visible associated chart). In this panel, the user can enter non-series specific chart attributes like main titles, axis formats, etc.. Also, with perhaps a single dummy series, the user can enter the format of the series that will be added to the chart at a later time.

2. When the series are added to the chart, the formatting saved previously with the Editor panel is applied to them, along with the formatting for the non-series specific attributes.

I don't think this is what the VB example is doing. Is it?
Not exactly. OK, so your users enter chart attributes into a form ... in this case, simply create a runtime instance of the TeeChart object, feed these parameters into it and save the chart as a TEE file as in the BLOBS example. Then you simply retrieve this TEE file, fill it with data and display it.
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/

GWRI
Newbie
Newbie
Posts: 7
Joined: Wed Apr 02, 2003 5:00 am
Location: USA
Contact:

Post by GWRI » Thu Jul 15, 2004 5:14 pm

Ok, I think I am able to use the ideas mentioned previously. Thanks for the help.

One question. I have added an editor panel to my VB 6 form. I have set the editor panel's chart property to the dummy chart mentioned previously. This works in the sense that as I enter chart properties in the editor panel, those properties are reflected on the dummy chart. However, when I export the dummy chart, the changes I have made do not seem to export. In fact, I stopped the execution right before the export code and checked some of the properties of the dummy chart and the properties that I had set were not present in the chart's properties to be exported. An example is the chart title or header. Though the dummy chart on the form said the title I had entered with the editor panel, the property dummychart.header.text(0) was actually the old title that the chart had before I entered the title with the editor panel.

My thought is that the "Close" button that is normally resident on the editor form shown when Tchart.ShowEditor is invoked actually commits changes to the chart. If one adds an editor panel to one's own form that is attached to a chart (also on the form), then there is no "Close" button and so even though changes are reflected on the screen, they are not committed to the chart object and are thus not available for export.

Is there any way to commit the changes to the chart so that they will be exported under my current set up (ie. with editor panel control on form and no "Close" button)?

Steve

GWRI
Newbie
Newbie
Posts: 7
Joined: Wed Apr 02, 2003 5:00 am
Location: USA
Contact:

update

Post by GWRI » Thu Jul 15, 2004 5:44 pm

Actually, I also tried to make changes to the dummy chart using the showeditor method and those changes do not seem to take effect either when I export the .tee file.

Just to be clear, here is my process.

All in runtime,

1. Import to the dummy chart the .tee file that is used for formatting
2. Make changes to the dummy chart with the showeditor form
3. Export (using chart.export.asnative.savetofile) the dummy chart to a .tee file.

The changes made in step 2 do not seem to be saved in step 3.

Any suggestions?

Steve

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Fri Jul 16, 2004 7:21 am

Hi Steve,

All in runtime,

1. Import to the dummy chart the .tee file that is used for formatting
2. Make changes to the dummy chart with the showeditor form
3. Export (using chart.export.asnative.savetofile) the dummy chart to a .tee file.

The changes made in step 2 do not seem to be saved in step 3.

The following code works as expected here:

Code: Select all

Dim DummyChart As Object
Dim Stream

Private Sub Command1_Click()
Stream = DummyChart.Export.asNative.SaveToStream(True)
TChart1.Import.LoadFromStream Stream
End Sub

Private Sub Form_Load()
Set DummyChart = CreateObject("TeeChart.TChart")
DummyChart.Import.LoadFromURL "http://www.steema.com/demo.tee"

ChartEditorPanel1.ChartLink = DummyChart.ChartLink
End Sub
Does this work OK at your end? If you are still experiencing problems, could you please modify the above code snippet so I can reproduce them here?

Many thanks.
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/

Post Reply