I'm having a problem with 6.04 in setting a date/time format for my x-axis. It seems that, whether I change the format in code
Chart1.Axis.Bottom.Labels.DateTimeFormat = "dd/mm/yy"
or via the TeeChart editor, the format remains as
dd/mm/yyyy hh:mm:ss
which I presume is my PC UK regional setting.
I'd like to 'fix' the format so it is the same regardless of the PC regional settings.
Am I missing something?
Regards
John
DateTimeFormat
Hi John,
I've tried here and works fine, could you please check if the following code works fine for you ?
I've tried here and works fine, could you please check if the following code works fine for you ?
Code: Select all
Private Sub Form_Load()
With TChart1
.Aspect.View3D = False
.AddSeries scFastLine
.Series(0).XValues.DateTime = True
.Series(0).AddXY DateValue("3/04/2002"), 4.346001, "", clTeeColor
.Series(0).AddXY DateValue("13/04/2002"), 3.503998, "", clTeeColor
.Series(0).AddXY DateValue("14/04/2002"), 4.637001, "", clTeeColor
.Series(0).AddXY DateValue("16/04/2002"), 3.785995, "", clTeeColor
.Series(0).AddXY DateValue("18/04/2002"), 5.417007, "", clTeeColor
.Series(0).AddXY DateValue("23/04/2002"), 5.218002, "", clTeeColor
.Series(0).AddXY DateValue("24/04/2002"), 2.684021, "", clTeeColor
.Series(0).AddXY DateValue("25/04/2002"), 2.753998, "", clTeeColor
.Series(0).AddXY DateValue("28/04/2002"), 3.515015, "", clTeeColor
.Axis.Bottom.Labels.DateTimeFormat = "dd/mm/yy"
.Axis.Bottom.Labels.Angle = 90
End With
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com
Will try as suggested tomorrow.
However, a bit more information - this is a web app. I am generating the Teechart to a file on the server populating from an ADO recordset as below - the database is SQL 2000, and the first field is a datetime I'm then reading from a URL on the client, using the TeeChart ActiveX control.
Chart1.Series(intSerindex).Addxy rs.Fields(0),rs.Fields(2),rs.Fields(0),1
I've tried setting the datetime format in code on the server, I've tried setting in code on the client, in the 'onload' event and then calling 'repaint, and I've tried changing via the Editor, and in all instances, the display stays as dd/mm/yyy hh:mm:ss - the PC regional setting on both the client and the server.
If I try to change the format in code, the new format is displayed as the current format in the editor.
However, a bit more information - this is a web app. I am generating the Teechart to a file on the server populating from an ADO recordset as below - the database is SQL 2000, and the first field is a datetime I'm then reading from a URL on the client, using the TeeChart ActiveX control.
Chart1.Series(intSerindex).Addxy rs.Fields(0),rs.Fields(2),rs.Fields(0),1
I've tried setting the datetime format in code on the server, I've tried setting in code on the client, in the 'onload' event and then calling 'repaint, and I've tried changing via the Editor, and in all instances, the display stays as dd/mm/yyy hh:mm:ss - the PC regional setting on both the client and the server.
If I try to change the format in code, the new format is displayed as the current format in the editor.
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hi John,
.Labels.DateTimeFormat = "dd/mm/yy"
Has no effect. Are the strings in rs.Fields(0) date formatted as "dd/mm/yy"? Most probably not, reading your messages carefully.
Alternatively, you could try:
I see you are adding in text labels to your series, in which case this:Chart1.Series(intSerindex).Addxy rs.Fields(0),rs.Fields(2),rs.Fields(0),1
.Labels.DateTimeFormat = "dd/mm/yy"
Has no effect. Are the strings in rs.Fields(0) date formatted as "dd/mm/yy"? Most probably not, reading your messages carefully.
Alternatively, you could try:
Code: Select all
Chart1.Series(intSerindex).Addxy rs.Fields(0),rs.Fields(2),"",1[code]
in which case:
.Labels.DateTimeFormat = "dd/mm/yy"
will have an effect.
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/
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/