DateTime XAxis label is not accurate

Found a possible bug in LightningChart? Report it here.

Moderator: Queue Moderators

Post Reply
Kountree
Posts: 21
Joined: Mon Jan 26, 2015 10:36 pm

DateTime XAxis label is not accurate

Post by Kountree » Thu Mar 05, 2015 7:45 pm

I have two issues. I am not sure why my date is March 4, 4024. (That year would make us all over 2000 years old) I verified the culture that I am using is USA. This is the sample that I am using that is taking directly from the temperature example. I am using .Net 2012 4.5 Framework

Also, is there a way to show milliSeconds?
[img]graph.jpg[/img]
Attachments
graph.JPG
graph.JPG (133.52 KiB) Viewed 14138 times

Kountree
Posts: 21
Joined: Mon Jan 26, 2015 10:36 pm

Re: DateTime XAxis label is not accurate

Post by Kountree » Thu Mar 05, 2015 8:28 pm

Ok, I solved my question, with the date, and lightweight solved the millisecond issue.
To get the correct date, I added the following code:

trend.ViewXY.XAxes[0].DateOriginYear = now.Date.Year;
trend.ViewXY.XAxes[0].DateOriginMonth = now.Date.Month;
trend.ViewXY.XAxes[0].DateOriginDay = now.Date.Day;

Hope this helps

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: DateTime XAxis label is not accurate

Post by ArctionPasi » Fri Mar 06, 2015 6:37 am

The DateOrigin must be set less than the date to be shown in the chart. DateOrigin is needed to be able to show microsecond-nanosecond level accuracy of date times, which goes beyond the accuracy of regular Double-precision of DateTimes in .NET.
LightningChart Support Team, PT

Kountree
Posts: 21
Joined: Mon Jan 26, 2015 10:36 pm

Re: DateTime XAxis label is not accurate

Post by Kountree » Fri Mar 06, 2015 2:53 pm

Disagree.

DateTime is in fact a double precision and can store millisecond accuracy. I stated that the millisecond is "lighweight" solved. When I implemented two markers on the chart, both the tool and .Net is able to display the double precision See the attached. My issue is that when the graph is created, it does not show milliseconds, however, the tool has been crafted to create a time graph that is synchronized with the system clock. The precision is very accurate to the second. And in fact, when I zoom in on the plot, the milliseconds are displayed. See the graph below, the times are pulled directly from the tool.
DateTime_Double_Precision_Dot_Net.PNG
DateTime_Double_Precision_Dot_Net.PNG (238.09 KiB) Viewed 14128 times

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: DateTime XAxis label is not accurate

Post by ArctionPasi » Fri Mar 06, 2015 3:36 pm

I just want to explain why the DateOrigin settings in LightningChart...

If you have total X-range of 1 ms, and want to present 1 GHz sampled data, there's 1 M points in 1 ms range.

.NET DateTime uses January 1, 0001 as date origin. The integer part of the double is seconds from that. The decimal part is fractions of a seconds. When having a long time period, the integer part needs lot of bits from 64-bit double, and it doesn't leave good accuracy for decimals. It would show as irregularly spaced divisions and data points packing in same coordinates in X dimension. Trust me, we know this from experience.

LightningChart has therefore date origin shifting, the integer part of DateTime's double is then minimal, leaving more bits for decimals and enabling nano-sec precision date time axes.
LightningChart Support Team, PT

Post Reply