Import Text with datetime
Posted: Mon Mar 19, 2007 12:28 pm
Thank you for your help to my questions.
Please accept my additionally question mentioned under.
In VB2005 and TeeChart foe NET V2,
----------- Export as text -----------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DataExport As New Steema.TeeChart.Export.DataExport(TChart1.Chart)
DataExport.Text.IncludeHeader = False
DataExport.Text.IncludeIndex = False
DataExport.Text.IncludeLabels = True
DataExport.Text.Series = Line1
DataExport.Text.Save(FileName)
End sub
This procedure makes text file as followings.
----- Exported File by Button1_Click ---
39159.7515823958 5.96103058474186
39159.7515939699 15.0420339196185
39159.751605544 14.3808898582966
39159.7516171181 14.1060914723697
39159.7516286921 14.1676675035468
39159.7516402662 3.56308315115193
39159.7516518403 18.5183631808117
----------------------------------------
with this text file,Button2_Click comes error.
-------- Import with TextSource -----------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Line1.XValues.DateTime = True
Dim ts As New Steema.TeeChart.Data.TextSource()
Try
Cursor = Cursors.WaitCursor
ts.HeaderLines = 0
ts.Separator = ","
ts.Series = Line1
ts.Fields.Add(0, "X") '---- Error because this field
not date string-----
ts.Fields.Add(2, "Y")
ts.LoadFromFile(FileName)
Finally
Cursor = Cursors.Default
End Try
End Sub
if Text is mentioned below, Button2_Click working fine.
------------------------------
2007/03/17 7:49:24,60.56,47.59
2007/03/17 7:49:24,73.32,24.34
2007/03/17 7:49:25,86.08,41.08
2007/03/17 7:49:26,68.84,57.83
2007/03/17 7:49:27,81.6,34.57
2007/03/17 7:49:28,64.36,51.31
2007/03/17 7:49:29,77.12,28.06
2007/03/17 7:49:30,89.88,44.8
2007/03/17 7:49:31,72.64,21.55
------------------------------
How can I do to solve it?
Is there the way to export datetime data as date string (Like above) ?
or is there the way to set (ts.Fields.Add(0,"X") as datetime from double?
Your kind advice will be highly appreciated.
Best Regards,
Please accept my additionally question mentioned under.
In VB2005 and TeeChart foe NET V2,
----------- Export as text -----------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DataExport As New Steema.TeeChart.Export.DataExport(TChart1.Chart)
DataExport.Text.IncludeHeader = False
DataExport.Text.IncludeIndex = False
DataExport.Text.IncludeLabels = True
DataExport.Text.Series = Line1
DataExport.Text.Save(FileName)
End sub
This procedure makes text file as followings.
----- Exported File by Button1_Click ---
39159.7515823958 5.96103058474186
39159.7515939699 15.0420339196185
39159.751605544 14.3808898582966
39159.7516171181 14.1060914723697
39159.7516286921 14.1676675035468
39159.7516402662 3.56308315115193
39159.7516518403 18.5183631808117
----------------------------------------
with this text file,Button2_Click comes error.
-------- Import with TextSource -----------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Line1.XValues.DateTime = True
Dim ts As New Steema.TeeChart.Data.TextSource()
Try
Cursor = Cursors.WaitCursor
ts.HeaderLines = 0
ts.Separator = ","
ts.Series = Line1
ts.Fields.Add(0, "X") '---- Error because this field
not date string-----
ts.Fields.Add(2, "Y")
ts.LoadFromFile(FileName)
Finally
Cursor = Cursors.Default
End Try
End Sub
if Text is mentioned below, Button2_Click working fine.
------------------------------
2007/03/17 7:49:24,60.56,47.59
2007/03/17 7:49:24,73.32,24.34
2007/03/17 7:49:25,86.08,41.08
2007/03/17 7:49:26,68.84,57.83
2007/03/17 7:49:27,81.6,34.57
2007/03/17 7:49:28,64.36,51.31
2007/03/17 7:49:29,77.12,28.06
2007/03/17 7:49:30,89.88,44.8
2007/03/17 7:49:31,72.64,21.55
------------------------------
How can I do to solve it?
Is there the way to export datetime data as date string (Like above) ?
or is there the way to set (ts.Fields.Add(0,"X") as datetime from double?
Your kind advice will be highly appreciated.
Best Regards,