Last change
on this file since 1530 was
1385,
checked in by gkragl, 15 years ago
|
Implemented persistence mechanism for XAxisLabelProvider (#434)
|
File size:
848 bytes
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Xml;
|
---|
3 |
|
---|
4 | namespace 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 | }
|
---|
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 | }
|
---|
30 | }
|
---|
31 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.