SerriesTextSource problem

TeeChart for ActiveX, COM and ASP
Post Reply
pro17
Newbie
Newbie
Posts: 11
Joined: Tue Feb 27, 2007 12:00 am

SerriesTextSource problem

Post by pro17 » Tue Nov 20, 2007 11:36 am

I am using txt file to get data into chart.
The problem I am experiencing is that chart "remembers" some settings and I can't reset it.

Reproducing the problem:
When I first get data to the chart everything works OK. Then I manipulate a vbscript code - I change (AddField "Bar", 2) to point to 1 (AddField "Bar", 1) - which is wrong of course (see the data file), and I get an error "georg" is not a valid floating point value.
Then I change the code back to original (AddField "Bar", 2) and I am still getting the same error! Looks like TChart object is linked or just remembered some setting and new settings dont override them.

How can I totaly reset the chart object (or something like this)?
I don't want to rebuild the application or to restart the app if there is an error in txt file or in a code (vbscript) ...


TChartObjet = graf0
SeriessTextSourceObject=serriestextsource

This is the code:
With seriestextsource
.Active= False
.Close
End with
With graf0
.RemoveAllSeries
.AddSeries 1
End With

With seriestextsource
.FileName = "test.txt"
.FieldSeparator = ";"
.Series = graf0.Series(0)
.Active = True
.HeaderLines = 1
.AddField "Bar", 2
' .AddField "Text", 1
End With

And this is the data in test.txt:
test;15
georg;14
mitch;14
hola;21

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 20, 2007 12:23 pm

Hi pro17,

You could try calling series' CheckDataSource method. To fully reset the chart you can call this:

Code: Select all

graf0.ClearChart
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

pro17
Newbie
Newbie
Posts: 11
Joined: Tue Feb 27, 2007 12:00 am

Post by pro17 » Tue Nov 20, 2007 12:56 pm

Hi Narcis,

Tried ClearChart, still the same problem.
Tried CheckDataSource, still the same problem.

Could you reproduce the problem?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 20, 2007 1:43 pm

Hi pro17,

This is most likely because you need to set Active for SeriesTextSource after all properties and fields have been assigned, for example:

Code: Select all

    With SeriesTextSource1
        .Active = False
        .Close
    End With
    
    With TChart1
        .RemoveAllSeries
        .AddSeries 1
    End With
    
    With SeriesTextSource1
        .FileName = "c:\temp\sourcetest.txt"
        .FieldSeparator = ";"
        .Series = TChart1.Series(0)
        
        .HeaderLines = 1
        .AddField "Bar", 2
        ' .AddField "Text", 1
        .Active = True
    End With
Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

pro17
Newbie
Newbie
Posts: 11
Joined: Tue Feb 27, 2007 12:00 am

Post by pro17 » Tue Nov 20, 2007 4:32 pm

Hi Narcis,

Unfortunatelly setting Active property to true after all settings are don doesn't help also.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Nov 21, 2007 8:27 am

Hi pro17,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here and let us know the TeeChart version you are using?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

pro17
Newbie
Newbie
Posts: 11
Joined: Tue Feb 27, 2007 12:00 am

Post by pro17 » Wed Nov 21, 2007 10:01 am

Hi Narcis,

I solved my problem!

Using TChart AX in SCADA I also inserted SeriesTextSource into it as a separate object.

Now I define a SeriesTextSource as an object in a VBScript code only.

Code: Select all

Set seriestextsource = CreateObject("TeeChart.SeriesTextSource")
This way, I get an error, when wrong columns are used, and get a normal chart when I change back the columns to the right order.

Thank's for your help!
Best Regards.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Nov 21, 2007 10:45 am

Hi pro17,

Don't mention it! I'm glad to hear you solved your problem.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply