PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Main/src/DynamicDataDisplay/TimeChartPlotter.cs

#
C# | 38 lines | 31 code | 7 blank | 0 comment | 4 complexity | 4a5fff2f7854f94c2cf76dd66384fda2 MD5 | raw file
 1using System;
 2using Microsoft.Research.DynamicDataDisplay;
 3using System.Windows;
 4using Microsoft.Research.DynamicDataDisplay.Navigation;
 5using Microsoft.Research.DynamicDataDisplay.Common;
 6using System.Windows.Controls;
 7using Microsoft.Research.DynamicDataDisplay.Charts;
 8
 9
10namespace Microsoft.Research.DynamicDataDisplay
11{
12	public class TimeChartPlotter : ChartPlotter
13	{
14		public TimeChartPlotter()
15		{
16			MainHorizontalAxis = new HorizontalDateTimeAxis();
17		}
18
19		public void SetHorizontalAxisMapping(Func<double, DateTime> fromDouble, Func<DateTime, double> toDouble)
20		{
21			if (fromDouble == null)
22				throw new ArgumentNullException("fromDouble");
23			if (toDouble == null)
24				throw new ArgumentNullException("toDouble");
25	
26
27			HorizontalDateTimeAxis axis = (HorizontalDateTimeAxis)MainHorizontalAxis;
28			axis.ConvertFromDouble = fromDouble;
29			axis.ConvertToDouble = toDouble;
30		}
31
32		public void SetHorizontalAxisMapping(double min, DateTime minDate, double max, DateTime maxDate) {
33			HorizontalDateTimeAxis axis = (HorizontalDateTimeAxis)MainHorizontalAxis;
34			
35			axis.SetConversion(min, minDate, max, maxDate);
36		}
37	}
38}