Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Charts/Axes/LabelProvider.cs @ 13847

Last change on this file since 13847 was 12503, checked in by aballeit, 10 years ago

#2283 added GUI and charts; fixed MCTS

File size: 983 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6using System.Windows.Controls;
7
8namespace 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.