/Main/src/DynamicDataDisplay/Charts/Axes/TimeSpan/TimeSpanLabelProvider.cs
# · C# · 33 lines · 29 code · 4 blank · 0 comment · 1 complexity · 3b9107625935ed9fa5349887e3da4822 MD5 · raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Controls;
- using Microsoft.Research.DynamicDataDisplay.Charts.Axes;
-
- namespace Microsoft.Research.DynamicDataDisplay.Charts
- {
- public class TimeSpanLabelProvider : LabelProviderBase<TimeSpan>
- {
- public override UIElement[] CreateLabels(ITicksInfo<TimeSpan> ticksInfo)
- {
- object info = ticksInfo.Info;
- var ticks = ticksInfo.Ticks;
-
- LabelTickInfo<TimeSpan> tickInfo = new LabelTickInfo<TimeSpan>();
-
- UIElement[] res = new UIElement[ticks.Length];
- for (int i = 0; i < ticks.Length; i++)
- {
- tickInfo.Tick = ticks[i];
- tickInfo.Info = info;
-
- string tickText = GetString(tickInfo);
- UIElement label = new TextBlock { Text = tickText, ToolTip = ticks[i] };
- res[i] = label;
- }
- return res;
- }
- }
- }