Changeset 1996 for trunk/sources/HeuristicLab.Visualization
- Timestamp:
- 06/04/09 00:41:56 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Visualization/3.2
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/AvgAggregator.cs ¶
r1993 r1996 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Xml;4 3 5 4 namespace HeuristicLab.Visualization { … … 148 147 } 149 148 150 public override XmlNode ToXml(XmlDocument document)151 {152 throw new System.NotImplementedException();153 }154 155 public override IDataRow FromXml(XmlNode xmlNode)156 {157 throw new System.NotImplementedException();158 }159 160 149 #endregion 161 150 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/AvgLineAggregator.cs ¶
r1993 r1996 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Xml;4 3 5 4 namespace HeuristicLab.Visualization { … … 159 158 } 160 159 161 public override XmlNode ToXml(XmlDocument document)162 {163 throw new System.NotImplementedException();164 }165 166 public override IDataRow FromXml(XmlNode xmlNode)167 {168 throw new System.NotImplementedException();169 }170 171 160 #endregion 172 161 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/ChartDataRowsModel.cs ¶
r1993 r1996 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Drawing;4 using System.Globalization;5 3 using System.Xml; 6 4 using HeuristicLab.Core; 7 5 using HeuristicLab.Visualization.Options; 8 using HeuristicLab.Visualization.Test;9 6 10 7 namespace HeuristicLab.Visualization{ … … 16 13 private string title = "Title"; 17 14 private ViewSettings viewSettings = new ViewSettings(); 18 private readonly XAxisDescriptor xAxisDescriptor = new XAxisDescriptor();15 private XAxisDescriptor xAxisDescriptor; 19 16 private YAxisDescriptor defaultYAxisDescriptor = new YAxisDescriptor(); 20 17 private readonly List<IDataRow> rows = new List<IDataRow>(); 21 18 22 19 public ChartDataRowsModel() { 23 this.XAxis .XAxisDescriptorChanged += delegate { OnModelChanged(); };20 this.XAxis = new XAxisDescriptor(); 24 21 } 25 22 … … 38 35 public XAxisDescriptor XAxis { 39 36 get { return xAxisDescriptor; } 37 private set { 38 this.xAxisDescriptor = value; 39 this.xAxisDescriptor.XAxisDescriptorChanged += delegate { OnModelChanged(); }; 40 } 40 41 } 41 42 … … 125 126 126 127 XmlSupport.SetAttribute("Title", title, node); 127 128 List<YAxisDescriptor> yAxes = new List<YAxisDescriptor>();129 yAxes.Add(defaultYAxisDescriptor);130 foreach (IDataRow row in rows) {131 if (!yAxes.Contains(row.YAxis)) {132 yAxes.Add(row.YAxis);133 }134 }135 136 foreach (YAxisDescriptor yAxis in yAxes) {137 XmlNode yAxisElement = document.CreateElement("YAxis");138 139 XmlSupport.SetAttribute("Label", yAxis.Label, yAxisElement);140 XmlSupport.SetAttribute("GridColor", yAxis.GridColor.ToArgb().ToString(), yAxisElement);141 XmlSupport.SetAttribute("Position", yAxis.Position.ToString(), yAxisElement);142 XmlSupport.SetAttribute("ShowGrid", yAxis.ShowGrid ? "true" : "false", yAxisElement);143 XmlSupport.SetAttribute("ShowYAxis", yAxis.ShowYAxis ? "true" : "false", yAxisElement);144 XmlSupport.SetAttribute("ShowYAxisLabel", yAxis.ShowYAxisLabel ? "true" : "false", yAxisElement);145 XmlSupport.SetAttribute("ClipChangeable", yAxis.ClipChangeable ? "true" : "false", yAxisElement);146 147 if (yAxis == defaultYAxisDescriptor)148 XmlSupport.SetAttribute("Default", "true", yAxisElement);149 150 node.AppendChild(yAxisElement);151 }152 153 XmlNode xAxisElement = document.CreateElement("XAxis");154 XmlSupport.SetAttribute("Color", xAxisDescriptor.Color.ToArgb().ToString(), xAxisElement);155 XmlSupport.SetAttribute("GridColor", xAxisDescriptor.GridColor.ToArgb().ToString(), xAxisElement);156 XmlSupport.SetAttribute("Label", xAxisDescriptor.Label, xAxisElement);157 XmlSupport.SetAttribute("ShowGrid", xAxisDescriptor.ShowGrid ? "true" : "false", xAxisElement);158 XmlSupport.SetAttribute("ShowLabel", xAxisDescriptor.ShowLabel ? "true" : "false", xAxisElement);159 node.AppendChild(xAxisElement);160 128 161 129 foreach (IDataRow row in rows) { 162 node.AppendChild( row.ToXml(document));130 node.AppendChild(PersistenceManager.Persist("DataRow", row, document, persistedObjects)); 163 131 } 164 165 node.AppendChild( XAxis.LabelProvider.GetLabelProviderXmlNode(document));132 node.AppendChild(PersistenceManager.Persist("DefaultYAxis", this.DefaultYAxis, document, persistedObjects)); 133 node.AppendChild(PersistenceManager.Persist("XAxis", this.XAxis, document, persistedObjects)); 166 134 167 135 return node; … … 173 141 title = XmlSupport.GetAttribute("Title", "", node); 174 142 175 List<YAxisDescriptor> yAxes = new List<YAxisDescriptor>(); 176 foreach (XmlNode yAxisNode in node.SelectNodes("YAxis")) { 177 YAxisDescriptor yAxis = new YAxisDescriptor(); 178 yAxis.Label = XmlSupport.GetAttribute("Label", "", yAxisNode); 179 yAxis.GridColor = Color.FromArgb(int.Parse(XmlSupport.GetAttribute("GridColor", Color.LightBlue.ToArgb().ToString(), yAxisNode))); 180 yAxis.Position = (AxisPosition)Enum.Parse(typeof(AxisPosition), XmlSupport.GetAttribute("Position", "Left", yAxisNode)); 181 yAxis.ShowGrid = XmlSupport.GetAttribute("ShowGrid", "true", yAxisNode) == "true"; 182 yAxis.ShowYAxis = XmlSupport.GetAttribute("ShowYAxis", "true", yAxisNode) == "true"; 183 yAxis.ShowYAxisLabel = XmlSupport.GetAttribute("ShowYAxisLabel", "true", yAxisNode) == "true"; 184 yAxis.ClipChangeable = XmlSupport.GetAttribute("ClipChangeable", "true", yAxisNode) == "true"; 185 yAxes.Add(yAxis); 186 187 if (XmlSupport.GetAttribute("Default", null, yAxisNode) != null) 188 defaultYAxisDescriptor = yAxis; 143 foreach (XmlNode dataRowNode in node.SelectNodes("DataRow")) { 144 IDataRow dataRow = (IDataRow)PersistenceManager.Restore(dataRowNode, restoredObjects); 145 AddDataRow(dataRow); 189 146 } 190 147 191 XmlNode xAxisElement = node.SelectSingleNode("XAxis"); 192 if (xAxisElement != null) { 193 xAxisDescriptor.Color = Color.FromArgb(int.Parse(XmlSupport.GetAttribute("Color", Color.Blue.ToArgb().ToString(), xAxisElement))); 194 xAxisDescriptor.GridColor = Color.FromArgb(int.Parse(XmlSupport.GetAttribute("GridColor", Color.LightBlue.ToArgb().ToString(), xAxisElement))); 195 xAxisDescriptor.Label = XmlSupport.GetAttribute("Label", "", xAxisElement); 196 xAxisDescriptor.ShowGrid = XmlSupport.GetAttribute("ShowGrid", "true", xAxisElement) == "true"; 197 xAxisDescriptor.ShowLabel = XmlSupport.GetAttribute("ShowLabel", "true", xAxisElement) == "true"; 198 } 148 XmlNode defaultYAxisNode = node.SelectSingleNode("DefaultYAxis"); 149 if (defaultYAxisNode != null) 150 this.defaultYAxisDescriptor = (YAxisDescriptor)PersistenceManager.Restore(defaultYAxisNode, restoredObjects); 199 151 200 XmlNode xAxisLabelProviderNode = node.SelectSingleNode("LabelProvider"); 201 xAxisDescriptor.LabelProvider = xAxisDescriptor.LabelProvider.PopulateLabelProviderXmlNode(xAxisLabelProviderNode); 202 203 foreach (XmlNode dataRow in node.SelectNodes("Row")) { 204 string rowLabel = XmlSupport.GetAttribute("Label", "", dataRow); 205 206 DataRow row = new DataRow(); 207 row.RowSettings.Label = rowLabel; 208 row.RowSettings.Color = Color.FromArgb(Int32.Parse(XmlSupport.GetAttribute("Color", Color.Black.ToArgb().ToString(), dataRow))); 209 row.RowSettings.LineType = (DataRowType)Enum.Parse(typeof(DataRowType), XmlSupport.GetAttribute("LineType", "Normal", dataRow)); 210 row.RowSettings.Thickness = Int32.Parse(XmlSupport.GetAttribute("Thickness", "2", dataRow)); 211 row.RowSettings.ShowMarkers = XmlSupport.GetAttribute("ShowMarkers", "true", dataRow) == "true"; 212 row.RowSettings.Style = (DrawingStyle)Enum.Parse(typeof (DrawingStyle), XmlSupport.GetAttribute("Style", DrawingStyle.Solid.ToString(), dataRow)); 213 214 foreach (YAxisDescriptor yAxis in yAxes) { 215 if (yAxis.Label.Equals(XmlSupport.GetAttribute("YAxis", dataRow))) 216 row.YAxis = yAxis; 217 } 218 219 string[] tokens = dataRow.InnerText.Split(';'); 220 foreach (string token in tokens) { 221 double value = double.Parse(token, CultureInfo.InvariantCulture); 222 row.AddValue(value); 223 } 224 225 AddDataRow(row); 226 } 152 XmlNode xAxisNode = node.SelectSingleNode("XAxis"); 153 if (xAxisNode != null) 154 this.XAxis = (XAxisDescriptor)PersistenceManager.Restore(xAxisNode, restoredObjects); 227 155 } 228 156 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/DataRow.cs ¶
r1993 r1996 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Drawing; 3 4 using System.Globalization; 4 5 using System.Xml; 6 using HeuristicLab.Core; 5 7 6 8 namespace HeuristicLab.Visualization { … … 156 158 } 157 159 158 public override XmlNode ToXml(XmlDocument document) {159 XmlNode columnElement = document.CreateNode(XmlNodeType.Element, "Row", null);160 161 XmlSupport.SetAttribute("Label", RowSettings.Label, columnElement);162 XmlSupport.SetAttribute("Color", RowSettings.Color.ToArgb().ToString(), columnElement);163 XmlSupport.SetAttribute("LineType", RowSettings.LineType.ToString(), columnElement);164 XmlSupport.SetAttribute("Thickness", RowSettings.Thickness.ToString(), columnElement);165 XmlSupport.SetAttribute("ShowMarkers", RowSettings.ShowMarkers ? "true" : "false", columnElement);166 XmlSupport.SetAttribute("Style", RowSettings.Style.ToString(), columnElement);167 168 XmlSupport.SetAttribute("YAxis", YAxis.Label, columnElement);169 170 List<string> strValues = new List<string>();171 for (int i = 0; i < this.Count; i++) {172 strValues.Add(this[i].ToString(CultureInfo.InvariantCulture));173 }174 columnElement.InnerText = string.Join(";", strValues.ToArray());175 176 return columnElement;177 }178 179 public override IDataRow FromXml(XmlNode xmlNode)180 {181 throw new System.NotImplementedException();182 }183 184 160 private void UpdateMinMaxValue(double newValue, int oldValueIndex) { 185 161 if (minValue != dataRow[oldValueIndex] && maxValue != dataRow[oldValueIndex]) … … 200 176 minValue = Math.Min(value, minValue); 201 177 } 178 179 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 180 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 181 182 XmlSupport.SetAttribute("Label", RowSettings.Label, node); 183 XmlSupport.SetAttribute("Color", RowSettings.Color.ToArgb().ToString(), node); 184 XmlSupport.SetAttribute("LineType", RowSettings.LineType.ToString(), node); 185 XmlSupport.SetAttribute("Thickness", RowSettings.Thickness.ToString(), node); 186 XmlSupport.SetAttribute("ShowMarkers", RowSettings.ShowMarkers ? "true" : "false", node); 187 XmlSupport.SetAttribute("Style", RowSettings.Style.ToString(), node); 188 189 node.AppendChild(PersistenceManager.Persist("YAxis", this.YAxis, document, persistedObjects)); 190 191 List<string> strValues = new List<string>(); 192 for (int i = 0; i < this.Count; i++) { 193 strValues.Add(this[i].ToString(CultureInfo.InvariantCulture)); 194 } 195 XmlElement valuesElement = document.CreateElement("Values"); 196 valuesElement.InnerText = string.Join(";", strValues.ToArray()); 197 node.AppendChild(valuesElement); 198 199 return node; 200 } 201 202 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 203 base.Populate(node, restoredObjects); 204 205 this.RowSettings.Label = XmlSupport.GetAttribute("Label", "", node); 206 this.RowSettings.Color = Color.FromArgb(Int32.Parse(XmlSupport.GetAttribute("Color", Color.Black.ToArgb().ToString(), node))); 207 this.RowSettings.LineType = (DataRowType)Enum.Parse(typeof(DataRowType), XmlSupport.GetAttribute("LineType", "Normal", node)); 208 this.RowSettings.Thickness = Int32.Parse(XmlSupport.GetAttribute("Thickness", "2", node)); 209 this.RowSettings.ShowMarkers = XmlSupport.GetAttribute("ShowMarkers", "true", node) == "true"; 210 this.RowSettings.Style = (DrawingStyle)Enum.Parse(typeof(DrawingStyle), XmlSupport.GetAttribute("Style", DrawingStyle.Solid.ToString(), node)); 211 212 XmlNode yAxisNode = node.SelectSingleNode("YAxis"); 213 if (yAxisNode != null) { 214 this.YAxis = (YAxisDescriptor)PersistenceManager.Restore(yAxisNode, restoredObjects); 215 } 216 217 XmlNode valuesNode = node.SelectSingleNode("Values"); 218 if (valuesNode != null) { 219 string[] strValues = valuesNode.InnerText.Split(';'); 220 foreach (string strValue in strValues) { 221 double value = double.Parse(strValue, CultureInfo.InvariantCulture); 222 this.AddValue(value); 223 } 224 } 225 } 202 226 } 203 227 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/DataRowBase.cs ¶
r1993 r1996 1 using System.Xml;1 using HeuristicLab.Core; 2 2 using HeuristicLab.Visualization.Options; 3 3 4 4 namespace HeuristicLab.Visualization { 5 public abstract class DataRowBase : IDataRow {6 pr ivateYAxisDescriptor yAxis;5 public abstract class DataRowBase : StorableBase, IDataRow { 6 protected YAxisDescriptor yAxis; 7 7 8 8 private DataRowSettings rowSettings ; … … 17 17 } 18 18 19 p ublicDataRowBase() {19 protected DataRowBase() { 20 20 rowSettings = new DataRowSettings(); 21 21 rowSettings.DataVisualSettingChanged += value_DataVisualSettingChanged; … … 55 55 56 56 public abstract void AddValue(double value); 57 58 57 public abstract void AddValue(double value, int index); 59 60 58 public abstract void AddValues(double[] values); 61 62 59 public abstract void AddValues(double[] values, int index); 63 64 60 public abstract void ModifyValue(double value, int index); 65 66 61 public abstract void ModifyValues(double[] values, int index); 67 68 62 public abstract void RemoveValue(int index); 69 70 63 public abstract void RemoveValues(int index, int count); 71 64 … … 75 68 76 69 public abstract double MinValue { get; } 77 78 70 public abstract double MaxValue { get; } 79 71 80 public abstract XmlNode ToXml(XmlDocument document);81 public abstract IDataRow FromXml(XmlNode xmlNode);82 83 84 72 public event ValuesChangedHandler ValuesChanged; 85 86 73 public event ValueChangedHandler ValueChanged; 87 88 74 public event DataRowChangedHandler DataRowChanged; 89 75 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/FloatingAvgAggregator.cs ¶
r1993 r1996 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Xml;4 3 5 4 namespace HeuristicLab.Visualization { … … 182 181 } 183 182 184 public override XmlNode ToXml(XmlDocument document)185 {186 throw new System.NotImplementedException();187 }188 189 public override IDataRow FromXml(XmlNode xmlNode)190 {191 throw new System.NotImplementedException();192 }193 194 183 #endregion 195 184 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/IDataRow.cs ¶
r1993 r1996 1 using System.Xml;1 using HeuristicLab.Core; 2 2 using HeuristicLab.Visualization.Options; 3 3 … … 8 8 } 9 9 10 public interface IDataRow {10 public interface IDataRow : IStorable { 11 11 DataRowSettings RowSettings { get; set; } 12 12 … … 30 30 double MaxValue { get; } 31 31 32 XmlNode ToXml(XmlDocument document);33 IDataRow FromXml(XmlNode xmlNode);34 35 32 event ValuesChangedHandler ValuesChanged; 36 33 event ValueChangedHandler ValueChanged; -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/ContinuousLabelProvider.cs ¶
r1993 r1996 1 1 using System.Globalization; 2 2 using System.Xml; 3 using HeuristicLab.Core; 3 4 4 5 namespace HeuristicLab.Visualization.LabelProvider { 5 public class ContinuousLabelProvider : ILabelProvider {6 private readonlystring format;6 public class ContinuousLabelProvider : StorableBase, ILabelProvider { 7 private string format; 7 8 8 9 public ContinuousLabelProvider() {} … … 16 17 } 17 18 18 public XmlNode GetLabelProviderXmlNode(XmlDocument document) 19 { 20 XmlNode lblProvInfo = document.CreateNode(XmlNodeType.Element, "LabelProvider", null); 21 lblProvInfo.InnerText = "ContinuousLabelProvider"; 19 public override XmlNode GetXmlNode(string name, XmlDocument document, System.Collections.Generic.IDictionary<System.Guid, IStorable> persistedObjects) { 20 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 22 21 23 XmlAttribute idFormat = document.CreateAttribute("format"); 24 idFormat.Value = this.format; 22 XmlSupport.SetAttribute("Format", format, node); 25 23 26 lblProvInfo.Attributes.Append(idFormat); 27 28 return lblProvInfo; 24 return node; 29 25 } 30 26 31 public ILabelProvider PopulateLabelProviderXmlNode(XmlNode node) { 32 var labelProvider = new ContinuousLabelProvider(node.SelectSingleNode("//LabelProvider").Attributes[0].Value); 33 return labelProvider; 27 public override void Populate(XmlNode node, System.Collections.Generic.IDictionary<System.Guid, IStorable> restoredObjects) { 28 base.Populate(node, restoredObjects); 29 30 this.format = XmlSupport.GetAttribute("Format", "0", node); 34 31 } 35 32 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/DiscreteLabelProvider.cs ¶
r1993 r1996 1 1 using System; 2 using System.Xml;2 using HeuristicLab.Core; 3 3 4 4 namespace HeuristicLab.Visualization.LabelProvider { 5 public class DiscreteLabelProvider : ILabelProvider {5 public class DiscreteLabelProvider : StorableBase, ILabelProvider { 6 6 public string GetLabel(double value) { 7 7 int index = (int)Math.Round(value); … … 13 13 return string.Empty; 14 14 } 15 16 public XmlNode GetLabelProviderXmlNode(XmlDocument document)17 {18 XmlNode lblProvInfo = document.CreateNode(XmlNodeType.Element, "LabelProvider", null);19 lblProvInfo.InnerText = "DiscreteLabelProvider";20 21 return lblProvInfo;22 }23 24 public ILabelProvider PopulateLabelProviderXmlNode(XmlNode node) {25 var labelProvider = new DiscreteLabelProvider();26 return labelProvider;27 }28 15 } 29 16 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/ILabelProvider.cs ¶
r1993 r1996 1 using System.Xml;1 using HeuristicLab.Core; 2 2 3 3 namespace HeuristicLab.Visualization.LabelProvider { 4 public interface ILabelProvider {4 public interface ILabelProvider : IStorable { 5 5 string GetLabel(double value); 6 XmlNode GetLabelProviderXmlNode(XmlDocument document);7 ILabelProvider PopulateLabelProviderXmlNode(XmlNode node);8 6 } 9 7 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/StringLabelProvider.cs ¶
r1993 r1996 2 2 using System.Collections.Generic; 3 3 using System.Xml; 4 using HeuristicLab.Core; 4 5 5 6 namespace HeuristicLab.Visualization.LabelProvider { 6 public class StringLabelProvider : ILabelProvider {7 public class StringLabelProvider : StorableBase, ILabelProvider { 7 8 private readonly Dictionary<int, string> labels = new Dictionary<int, string>(); 8 9 … … 27 28 } 28 29 29 public XmlNode GetLabelProviderXmlNode(XmlDocument document) { 30 XmlNode lblProvInfo = document.CreateNode(XmlNodeType.Element, "LabelProvider", null); 31 lblProvInfo.InnerText = "StringLabelProvider"; 30 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 31 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 32 32 33 foreach (KeyValuePair<int, string> pair in labels) 34 { 35 XmlNode strLbl = document.CreateNode(XmlNodeType.Element, "String", null); 33 XmlNode labelsNode = document.CreateElement("Labels"); 36 34 37 XmlAttribute idStrLbl = document.CreateAttribute("id");38 i dStrLbl.Value = pair.Key.ToString();39 str Lbl.Attributes.Append(idStrLbl);35 foreach (KeyValuePair<int, string> pair in labels) { 36 int index = pair.Key; 37 string label = pair.Value; 40 38 41 strLbl.InnerText = pair.Value; 42 lblProvInfo.AppendChild(strLbl); 39 XmlNode labelNode = document.CreateElement("Label"); 40 41 XmlSupport.SetAttribute("Index", index.ToString(), labelNode); 42 XmlSupport.SetAttribute("Value", label, labelNode); 43 44 labelsNode.AppendChild(labelNode); 43 45 } 44 return lblProvInfo; 46 47 node.AppendChild(labelsNode); 48 49 return node; 45 50 } 46 51 47 public ILabelProvider PopulateLabelProviderXmlNode(XmlNode node) {48 var labelProvider = new StringLabelProvider();52 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 53 base.Populate(node, restoredObjects); 49 54 50 foreach (XmlNode strLbl in node.SelectNodes("//String")) 51 { 52 labelProvider.SetLabel(int.Parse(strLbl.Attributes[0].Value), strLbl.InnerText); 55 foreach (XmlNode labelNode in node.SelectNodes("Labels/Label")) { 56 int index = int.Parse(XmlSupport.GetAttribute("Index", labelNode)); 57 string label = XmlSupport.GetAttribute("Value", labelNode); 58 59 this.SetLabel(index, label); 53 60 } 54 return labelProvider;55 61 } 56 62 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/MaxAggregator.cs ¶
r1993 r1996 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Xml;4 3 5 4 namespace HeuristicLab.Visualization { … … 116 115 } 117 116 118 public override XmlNode ToXml(XmlDocument document)119 {120 throw new System.NotImplementedException();121 }122 123 public override IDataRow FromXml(XmlNode xmlNode)124 {125 throw new System.NotImplementedException();126 }127 128 117 #endregion 129 118 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/MinAggregator.cs ¶
r1993 r1996 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Xml;4 3 5 4 namespace HeuristicLab.Visualization { … … 117 116 } 118 117 119 public override XmlNode ToXml(XmlDocument document)120 {121 throw new System.NotImplementedException();122 }123 124 public override IDataRow FromXml(XmlNode xmlNode)125 {126 throw new System.NotImplementedException();127 }128 129 118 #endregion 130 119 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/XAxisDescriptor.cs ¶
r1993 r1996 1 using System; 2 using System.Collections.Generic; 1 3 using System.Drawing; 4 using System.Xml; 5 using HeuristicLab.Core; 2 6 using HeuristicLab.Visualization.LabelProvider; 3 7 … … 5 9 public delegate void XAxisDescriptorChangedHandler(XAxisDescriptor sender); 6 10 7 public class XAxisDescriptor {11 public class XAxisDescriptor : StorableBase { 8 12 private string label = ""; 9 13 private Font font = new Font("Arial", 8); … … 76 80 XAxisDescriptorChanged(this); 77 81 } 82 83 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 84 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 85 86 XmlSupport.SetAttribute("Color", this.Color.ToArgb().ToString(), node); 87 XmlSupport.SetAttribute("GridColor", this.GridColor.ToArgb().ToString(), node); 88 XmlSupport.SetAttribute("Label", this.Label, node); 89 XmlSupport.SetAttribute("ShowGrid", this.ShowGrid ? "true" : "false", node); 90 XmlSupport.SetAttribute("ShowLabel", this.ShowLabel ? "true" : "false", node); 91 92 node.AppendChild(PersistenceManager.Persist("LabelProvider", this.LabelProvider, document, persistedObjects)); 93 94 return node; 95 } 96 97 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 98 base.Populate(node, restoredObjects); 99 100 this.Color = Color.FromArgb(int.Parse(XmlSupport.GetAttribute("Color", Color.Blue.ToArgb().ToString(), node))); 101 this.GridColor = Color.FromArgb(int.Parse(XmlSupport.GetAttribute("GridColor", Color.LightBlue.ToArgb().ToString(), node))); 102 this.Label = XmlSupport.GetAttribute("Label", "", node); 103 this.ShowGrid = XmlSupport.GetAttribute("ShowGrid", "true", node) == "true"; 104 this.ShowLabel = XmlSupport.GetAttribute("ShowLabel", "true", node) == "true"; 105 106 XmlNode labelProviderNode = node.SelectSingleNode("XAxis"); 107 if (labelProviderNode != null) 108 this.labelProvider = (ILabelProvider)PersistenceManager.Restore(labelProviderNode, restoredObjects); 109 } 78 110 } 79 111 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/3.2/YAxisDescriptor.cs ¶
r1969 r1996 2 2 using System.Collections.Generic; 3 3 using System.Drawing; 4 using System.Xml; 5 using HeuristicLab.Core; 4 6 using HeuristicLab.Visualization.LabelProvider; 5 7 using HeuristicLab.Visualization.Test; … … 8 10 public delegate void YAxisDescriptorChangedHandler(YAxisDescriptor sender); 9 11 10 public class YAxisDescriptor {11 private ILabelProvider yAxisLabelProvider = new ContinuousLabelProvider("0.##");12 public class YAxisDescriptor : StorableBase { 13 private ILabelProvider labelProvider = new ContinuousLabelProvider("0.##"); 12 14 private readonly List<IDataRow> dataRows = new List<IDataRow>(); 13 15 private bool showYAxis = true; … … 48 50 } 49 51 50 public ILabelProvider YAxisLabelProvider {51 get { return yAxisLabelProvider; }52 public ILabelProvider LabelProvider { 53 get { return labelProvider; } 52 54 set { 53 yAxisLabelProvider = value;55 labelProvider = value; 54 56 OnYAxisDescriptorChanged(); 55 57 } … … 124 126 OnYAxisDescriptorChanged(); 125 127 } 128 129 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 130 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 131 132 XmlSupport.SetAttribute("Label", this.Label, node); 133 XmlSupport.SetAttribute("GridColor", this.GridColor.ToArgb().ToString(), node); 134 XmlSupport.SetAttribute("Position", this.Position.ToString(), node); 135 XmlSupport.SetAttribute("ShowGrid", this.ShowGrid ? "true" : "false", node); 136 XmlSupport.SetAttribute("ShowYAxis", this.ShowYAxis ? "true" : "false", node); 137 XmlSupport.SetAttribute("ShowYAxisLabel", this.ShowYAxisLabel ? "true" : "false", node); 138 XmlSupport.SetAttribute("ClipChangeable", this.ClipChangeable ? "true" : "false", node); 139 140 node.AppendChild(PersistenceManager.Persist("LabelProvider", this.LabelProvider, document, persistedObjects)); 141 142 foreach (IDataRow row in dataRows) { 143 node.AppendChild(PersistenceManager.Persist("DataRow", row, document, persistedObjects)); 144 } 145 146 return node; 147 } 148 149 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 150 base.Populate(node, restoredObjects); 151 152 this.Label = XmlSupport.GetAttribute("Label", "", node); 153 this.GridColor = Color.FromArgb(int.Parse(XmlSupport.GetAttribute("GridColor", Color.LightBlue.ToArgb().ToString(), node))); 154 this.Position = (AxisPosition)Enum.Parse(typeof(AxisPosition), XmlSupport.GetAttribute("Position", "Left", node)); 155 this.ShowGrid = XmlSupport.GetAttribute("ShowGrid", "true", node) == "true"; 156 this.ShowYAxis = XmlSupport.GetAttribute("ShowYAxis", "true", node) == "true"; 157 this.ShowYAxisLabel = XmlSupport.GetAttribute("ShowYAxisLabel", "true", node) == "true"; 158 this.ClipChangeable = XmlSupport.GetAttribute("ClipChangeable", "true", node) == "true"; 159 160 XmlNode labelProviderNode = node.SelectSingleNode("LabelProvider"); 161 if (labelProviderNode != null) 162 this.labelProvider = (ILabelProvider)PersistenceManager.Restore(labelProviderNode, restoredObjects); 163 164 foreach (XmlNode dataRowNode in node.SelectNodes("DataRow")) { 165 IDataRow row = (IDataRow)PersistenceManager.Restore(dataRowNode, restoredObjects); 166 AddDataRow(row); 167 } 168 } 126 169 } 127 170 }
Note: See TracChangeset
for help on using the changeset viewer.