SerriesTextSource problem
Posted: 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
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