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

# · C# · 33 lines · 29 code · 4 blank · 0 comment · 1 complexity · 3b9107625935ed9fa5349887e3da4822 MD5 · raw file

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