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
SerriesTextSource problem
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi pro17,
You could try calling series' CheckDataSource method. To fully reset the chart you can call this:
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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi pro17,
This is most likely because you need to set Active for SeriesTextSource after all properties and fields have been assigned, for example:
Hope this helps!
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
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
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.
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.
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")
Thank's for your help!
Best Regards.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi pro17,
Don't mention it! I'm glad to hear you solved your problem.
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 |
Instructions - How to post in this forum |