Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization/LabelProvider/DiscreteLabelProvider.cs @ 1411

Last change on this file since 1411 was 1385, checked in by gkragl, 16 years ago

Implemented persistence mechanism for XAxisLabelProvider (#434)

File size: 848 bytes
RevLine 
[1194]1using System;
[1385]2using System.Xml;
[1194]3
4namespace HeuristicLab.Visualization.LabelProvider {
5  public class DiscreteLabelProvider : ILabelProvider {
6    public string GetLabel(double value) {
7      int index = (int)Math.Round(value);
8      double delta = Math.Abs(index - value);
9
10      if (delta < 1e-10)
11        return index.ToString();
12      else
13        return string.Empty;
14    }
[1385]15
16    public XmlNode GetLabelProviderXmlNode()
17    {
18      XmlDocument Xdoc = new XmlDocument();
19
20      XmlNode lblProvInfo = Xdoc.CreateNode(XmlNodeType.Element, "LabelProvider", null);
21      lblProvInfo.InnerText = "DiscreteLabelProvider";
22
23      return lblProvInfo;
24    }
25
26    public ILabelProvider PopulateLabelProviderXmlNode(XmlNode node) {
27      var labelProvider = new DiscreteLabelProvider();
28      return labelProvider;
29    }
[1194]30  }
31}
Note: See TracBrowser for help on using the repository browser.