date time format not working

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
asiminator
Newbie
Newbie
Posts: 4
Joined: Tue Oct 05, 2010 12:00 am

date time format not working

Post by asiminator » Mon Oct 18, 2010 10:33 am

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 6977 times
Please help.

Asim

Yeray
Site Admin
Site Admin
Posts: 9543
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: date time format not working

Post by Yeray » Tue Oct 19, 2010 10:12 am

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

asiminator
Newbie
Newbie
Posts: 4
Joined: Tue Oct 05, 2010 12:00 am

Re: date time format not working

Post by asiminator » Tue Oct 19, 2010 12:32 pm

Perfect.

Thanks

Yeray
Site Admin
Site Admin
Posts: 9543
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: date time format not working

Post by Yeray » Tue Oct 19, 2010 1:07 pm

Hi Asim,

You're welcome! :D
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply