PageRenderTime 28ms CodeModel.GetById 19ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/Main/src/DynamicDataDisplay/Charts/Axes/TimeSpan/TimeSpanLabelProvider.cs

#
C# | 33 lines | 29 code | 4 blank | 0 comment | 1 complexity | 3b9107625935ed9fa5349887e3da4822 MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5using System.Windows;
 6using System.Windows.Controls;
 7using Microsoft.Research.DynamicDataDisplay.Charts.Axes;
 8
 9namespace Microsoft.Research.DynamicDataDisplay.Charts
10{
11	public class TimeSpanLabelProvider : LabelProviderBase<TimeSpan>
12	{
13		public override UIElement[] CreateLabels(ITicksInfo<TimeSpan> ticksInfo)
14		{
15			object info = ticksInfo.Info;
16			var ticks = ticksInfo.Ticks;
17
18			LabelTickInfo<TimeSpan> tickInfo = new LabelTickInfo<TimeSpan>();
19
20			UIElement[] res = new UIElement[ticks.Length];
21			for (int i = 0; i < ticks.Length; i++)
22			{
23				tickInfo.Tick = ticks[i];
24				tickInfo.Info = info;
25
26				string tickText = GetString(tickInfo);
27				UIElement label = new TextBlock { Text = tickText, ToolTip = ticks[i] };
28				res[i] = label;
29			}
30			return res;
31		}
32	}
33}