Page 1 of 1

date time format not working

Posted: Mon Oct 18, 2010 10:33 am
by 15357428
Hi Everyone.

This is my first time on the support forum so sorry if i have missed some information.

Im trying to display date time data on a graph and i want it to be quick so I add data using arrays and date time as milliseconds since epoch:

Code: Select all

                        rs = conn.QueryDB("Select millisecondssinceepoch(thedatetime), chan257"
                        + "from data10hz "
                        + "where thedate = to_date('" + selectedDate +  "','YYYY-MM-DD') and resim = '0'"
                        + "order by thedatetime");
load the data into arrays:

Code: Select all

Line1.add(xarray1, yarray1);
The graph displays fine but the x axis is obviously a number.

So i read the tutorial and the tried the following code with no success:

Code: Select all

            tChart1.getAxes().getBottom().isDateTime();
            tChart1.getAxes().getBottom().getLabels().setDateTimeFormat("dd-MM-yyyy hh:mm:ss");
then i use the editor and by double clicking on one of the series and then selecting DateTime in General the problem is fixed. (Apart from the fact i need 24 hour time)
teechart.JPG
teechart.JPG (101.14 KiB) Viewed 7456 times
Please help.

Asim

Re: date time format not working

Posted: Tue Oct 19, 2010 10:12 am
by yeray
Hi Asim,

Note that isDateTime function returns a boolean. It is used to retrieve the information, not to set it.
To set it, as you've seen through the editor, you have to set the series' XValues to be DateTime. For example:

Code: Select all

tChart1.getSeries(0).getXValues().setDateTime(true);
I hope it helps.

Re: date time format not working

Posted: Tue Oct 19, 2010 12:32 pm
by 15357428
Perfect.

Thanks

Re: date time format not working

Posted: Tue Oct 19, 2010 1:07 pm
by yeray
Hi Asim,

You're welcome! :D