using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using Microsoft.Research.DynamicDataDisplay.Charts.Axes; using System.Globalization; namespace Microsoft.Research.DynamicDataDisplay.Charts { /// /// Represents a simple label provider for double ticks, which simply returns result of .ToString() method, called for rounded ticks. /// public class ToStringLabelProvider : NumericLabelProviderBase { /// /// Initializes a new instance of the class. /// public ToStringLabelProvider() { } public override UIElement[] CreateLabels(ITicksInfo ticksInfo) { var ticks = ticksInfo.Ticks; Init(ticks); UIElement[] res = new UIElement[ticks.Length]; LabelTickInfo tickInfo = new LabelTickInfo { Info = ticksInfo.Info }; for (int i = 0; i < res.Length; i++) { tickInfo.Tick = ticks[i]; tickInfo.Index = i; string labelText = GetString(tickInfo); TextBlock label = (TextBlock)GetResourceFromPool(); if (label == null) { label = new TextBlock(); } label.Text = labelText; label.ToolTip = ticks[i].ToString(); res[i] = label; ApplyCustomView(tickInfo, label); } return res; } } }