2013-10-31 2 views
0

DataFieldX 값이 DateTime이고 시각적으로 작동하지만 LineTime을 구현 한 후 DateTime으로 다시 변환 할 수없는 LineSeries가 있습니다.DateTime 축 데이터를 다시 DateTime으로 변환

 Plot plot = sender as Plot; 
     var series = plot.GetSeriesFromPoint(new ScreenPoint(e.GetPosition(plot).X, e.GetPosition(plot).Y), 10); 
     var result = series.GetNearestPoint(new ScreenPoint(e.GetPosition(plot).X, e.GetPosition(plot).Y), true); 
     var data = result.DataPoint; 
     DateTime dt = new DateTime(); 
     dt = dt.AddSeconds(data.X); 

data.X는 41577.61596880656이며 차트의 요점은 31/10/2013 14:47입니다. dt가 끝납니다 01.01.0001 11:32:57

어떻게 data.X를 DateTime으로 다시 변환 할 수 있습니까? 나는 0.3 초 ​​난이를 실행할 때

+0

oxyplot을 사용한 적이 없지만 아마도 도움이 될 것입니다. http://oxyplot.codeplex.com/discussions/348859 – geedubb

답변

2

당신은 어떤 이유로 1899

DateTime dt = new DateTime(1899,12,31); 
dt = dt.AddDays(data.X); 

년 12 월 31 일 날짜에 일이 아닌 초를 추가해야합니다. 나는이 데이터가 저장되는 형식의 정밀도 떨어져 기반으로 믿고있어.

enter image description here

2

DateTimeAxis.ToDateTime() 필요한 변환을 수행하지 않습니다?