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 | /// <summary>
|
---|
11 | /// Represents default implementation of label provider for specified type.
|
---|
12 | /// </summary>
|
---|
13 | /// <typeparam name="T">Axis values type.</typeparam>
|
---|
14 | public class GenericLabelProvider<T> : LabelProviderBase<T>
|
---|
15 | {
|
---|
16 | /// <summary>
|
---|
17 | /// Initializes a new instance of the <see cref="GenericLabelProvider<T>"/> class.
|
---|
18 | /// </summary>
|
---|
19 | public GenericLabelProvider() { }
|
---|
20 |
|
---|
21 | #region ILabelProvider<T> Members
|
---|
22 |
|
---|
23 | /// <summary>
|
---|
24 | /// Creates the labels by given ticks info.
|
---|
25 | /// </summary>
|
---|
26 | /// <param name="ticksInfo">The ticks info.</param>
|
---|
27 | /// <returns>
|
---|
28 | /// Array of <see cref="UIElement"/>s, which are axis labels for specified axis ticks.
|
---|
29 | /// </returns>
|
---|
30 | public override UIElement[] CreateLabels(ITicksInfo<T> ticksInfo)
|
---|
31 | {
|
---|
32 | var ticks = ticksInfo.Ticks;
|
---|
33 | var info = ticksInfo.Info;
|
---|
34 |
|
---|
35 | LabelTickInfo<T> tickInfo = new LabelTickInfo<T>();
|
---|
36 | UIElement[] res = new UIElement[ticks.Length];
|
---|
37 | for (int i = 0; i < res.Length; i++)
|
---|
38 | {
|
---|
39 | tickInfo.Tick = ticks[i];
|
---|
40 | tickInfo.Info = info;
|
---|
41 |
|
---|
42 | string text = GetString(tickInfo);
|
---|
43 |
|
---|
44 | res[i] = new TextBlock
|
---|
45 | {
|
---|
46 | Text = text,
|
---|
47 | ToolTip = ticks[i].ToString()
|
---|
48 | };
|
---|
49 | }
|
---|
50 | return res;
|
---|
51 | }
|
---|
52 |
|
---|
53 | #endregion
|
---|
54 | }
|
---|
55 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.