Line | |
---|
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 |
|
---|
9 | namespace Microsoft.Research.DynamicDataDisplay.Charts
|
---|
10 | {
|
---|
11 | /// <summary>
|
---|
12 | /// Represents a label provider for <see cref="System.DateTime"/> ticks.
|
---|
13 | /// </summary>
|
---|
14 | public class DateTimeLabelProvider : DateTimeLabelProviderBase
|
---|
15 | {
|
---|
16 | /// <summary>
|
---|
17 | /// Initializes a new instance of the <see cref="DateTimeLabelProvider"/> class.
|
---|
18 | /// </summary>
|
---|
19 | public DateTimeLabelProvider() { }
|
---|
20 |
|
---|
21 | public override UIElement[] CreateLabels(ITicksInfo<DateTime> ticksInfo)
|
---|
22 | {
|
---|
23 | object info = ticksInfo.Info;
|
---|
24 | var ticks = ticksInfo.Ticks;
|
---|
25 |
|
---|
26 | if (info is DifferenceIn)
|
---|
27 | {
|
---|
28 | DifferenceIn diff = (DifferenceIn)info;
|
---|
29 | DateFormat = GetDateFormat(diff);
|
---|
30 | }
|
---|
31 |
|
---|
32 | LabelTickInfo<DateTime> tickInfo = new LabelTickInfo<DateTime> { Info = info };
|
---|
33 |
|
---|
34 | UIElement[] res = new UIElement[ticks.Length];
|
---|
35 | for (int i = 0; i < ticks.Length; i++)
|
---|
36 | {
|
---|
37 | tickInfo.Tick = ticks[i];
|
---|
38 |
|
---|
39 | string tickText = GetString(tickInfo);
|
---|
40 | UIElement label = new TextBlock { Text = tickText, ToolTip = ticks[i] };
|
---|
41 | ApplyCustomView(tickInfo, label);
|
---|
42 | res[i] = label;
|
---|
43 | }
|
---|
44 |
|
---|
45 | return res;
|
---|
46 | }
|
---|
47 | }
|
---|
48 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.