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 |
|
---|
8 | namespace Microsoft.Research.DynamicDataDisplay.Charts.Axes
|
---|
9 | {
|
---|
10 | public abstract class LabelProvider<T> : LabelProviderBase<T>
|
---|
11 | {
|
---|
12 | public override UIElement[] CreateLabels(ITicksInfo<T> ticksInfo)
|
---|
13 | {
|
---|
14 | var ticks = ticksInfo.Ticks;
|
---|
15 |
|
---|
16 | UIElement[] res = new UIElement[ticks.Length];
|
---|
17 | LabelTickInfo<T> labelInfo = new LabelTickInfo<T> { Info = ticksInfo.Info };
|
---|
18 |
|
---|
19 | for (int i = 0; i < res.Length; i++)
|
---|
20 | {
|
---|
21 | labelInfo.Tick = ticks[i];
|
---|
22 | labelInfo.Index = i;
|
---|
23 |
|
---|
24 | string labelText = GetString(labelInfo);
|
---|
25 |
|
---|
26 | TextBlock label = (TextBlock)GetResourceFromPool();
|
---|
27 | if (label == null)
|
---|
28 | {
|
---|
29 | label = new TextBlock();
|
---|
30 | }
|
---|
31 |
|
---|
32 | label.Text = labelText;
|
---|
33 | label.ToolTip = ticks[i].ToString();
|
---|
34 |
|
---|
35 | res[i] = label;
|
---|
36 |
|
---|
37 | ApplyCustomView(labelInfo, label);
|
---|
38 | }
|
---|
39 |
|
---|
40 | return res;
|
---|
41 | }
|
---|
42 | }
|
---|
43 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.