Changeset 1988
- Timestamp:
- 06/01/09 12:34:56 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Visualization/3.2
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/3.2/AvgAggregator.cs
r1607 r1988 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Xml; 3 4 4 5 namespace HeuristicLab.Visualization { … … 147 148 } 148 149 150 public override XmlNode ToXml(IDataRow row, 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 149 160 #endregion 150 161 } -
trunk/sources/HeuristicLab.Visualization/3.2/AvgLineAggregator.cs
r1818 r1988 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Xml; 3 4 4 5 namespace HeuristicLab.Visualization { … … 158 159 } 159 160 161 public override XmlNode ToXml(IDataRow row, 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 160 171 #endregion 161 172 } -
trunk/sources/HeuristicLab.Visualization/3.2/ChartDataRowsModel.cs
r1986 r1988 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Drawing; 3 4 using System.Globalization; 4 5 using System.Xml; … … 16 17 private ViewSettings viewSettings = new ViewSettings(); 17 18 private readonly XAxisDescriptor xAxisDescriptor = new XAxisDescriptor(); 18 private readonlyYAxisDescriptor defaultYAxisDescriptor = new YAxisDescriptor();19 private YAxisDescriptor defaultYAxisDescriptor = new YAxisDescriptor(); 19 20 private readonly List<IDataRow> rows = new List<IDataRow>(); 20 21 … … 122 123 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 123 124 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 124 125 126 List<YAxisDescriptor> yAxis = new List<YAxisDescriptor>(); 127 yAxis.Add(defaultYAxisDescriptor); 125 128 foreach (IDataRow row in rows) { 126 XmlNode columnElement = document.CreateNode(XmlNodeType.Element, "row", null); 127 128 XmlAttribute idAttr = document.CreateAttribute("label"); 129 idAttr.Value = row.RowSettings.Label; 130 columnElement.Attributes.Append(idAttr); 131 132 StringBuilder builder = new StringBuilder(); 133 134 for (int i = 0; i < row.Count; i++) { 135 if (i == 0) { 136 builder.Append(row[i].ToString(CultureInfo.InvariantCulture.NumberFormat)); 137 //columnElement.InnerText += row[i].ToString(CultureInfo.InvariantCulture.NumberFormat); 138 } else { 139 builder.Append(";" + row[i].ToString(CultureInfo.InvariantCulture.NumberFormat)); 140 //columnElement.InnerText += ";" + row[i].ToString(CultureInfo.InvariantCulture.NumberFormat); 141 } 142 } 143 columnElement.InnerText += builder.ToString(); 144 node.AppendChild(columnElement); 129 XmlNode rowElement = row.ToXml(row, document); 130 131 if (!yAxis.Contains(row.YAxis)) { 132 yAxis.Add(row.YAxis); 133 } 134 135 node.AppendChild(rowElement); 136 } 137 138 foreach (YAxisDescriptor axis in yAxis) { 139 XmlNode yAxisElement = document.CreateNode(XmlNodeType.Element, "yAxis", null); 140 141 XmlAttribute attrLabel = document.CreateAttribute("label"); 142 attrLabel.Value = axis.Label; 143 yAxisElement.Attributes.Append(attrLabel); 144 145 if (axis == defaultYAxisDescriptor) { 146 XmlAttribute attrDefault = document.CreateAttribute("default"); 147 attrDefault.Value = "true"; 148 yAxisElement.Attributes.Append(attrDefault); 149 } 150 node.AppendChild(yAxisElement); 151 145 152 } 146 153 … … 148 155 node.AppendChild(labelProviderNode); 149 156 150 return node; 157 return node; 151 158 } 152 159 153 160 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 154 161 base.Populate(node, restoredObjects); 162 163 List<YAxisDescriptor> yAxis = new List<YAxisDescriptor>(); 164 foreach (XmlNode dataRow in node.ChildNodes) 165 { 166 if (dataRow.Name.Equals("yAxis")) 167 { 168 XmlAttributeCollection attrs = dataRow.Attributes; 169 170 XmlAttribute attrYAxisLabel = (XmlAttribute)attrs.GetNamedItem("label"); 171 string axisLabel = attrYAxisLabel.Value; 172 YAxisDescriptor axis = new YAxisDescriptor(); 173 axis.Label = axisLabel; 174 yAxis.Add(axis); 175 176 XmlAttribute attrDefault = (XmlAttribute)attrs.GetNamedItem("default"); 177 if (attrDefault != null) { 178 defaultYAxisDescriptor = axis; 179 } 180 } 181 } 155 182 156 183 foreach (XmlNode dataRow in node.ChildNodes) { 157 184 if (dataRow.Name.Equals("LabelProvider")) { 158 185 XAxis.LabelProvider = XAxis.LabelProvider.PopulateLabelProviderXmlNode(dataRow); 159 } else {186 } else if (dataRow.Name.Equals("row")) { 160 187 XmlAttributeCollection attrs = dataRow.Attributes; 161 188 XmlAttribute rowIdAttr = (XmlAttribute)attrs.GetNamedItem("label"); 162 189 string rowLabel = rowIdAttr.Value; 190 string rowColor = attrs.GetNamedItem("color").Value; 191 163 192 DataRow row = new DataRow(); 164 193 row.RowSettings.Label = rowLabel; 194 row.RowSettings.Color = Color.FromName(rowColor); 195 196 string yAxisLabel = attrs.GetNamedItem("yAxis").Value; 197 foreach (YAxisDescriptor axis in yAxis) { 198 if (axis.Label.Equals(yAxisLabel)) { 199 row.YAxis = axis; 200 } 201 } 165 202 166 203 string[] tokens = dataRow.InnerText.Split(';'); -
trunk/sources/HeuristicLab.Visualization/3.2/DataRow.cs
r1984 r1988 2 2 using System.Drawing; 3 3 using System.Collections.Generic; 4 using System.Globalization; 5 using System.Text; 6 using System.Xml; 4 7 5 8 namespace HeuristicLab.Visualization { … … 174 177 } 175 178 179 public override XmlNode ToXml(IDataRow row, XmlDocument document) 180 { 181 XmlNode columnElement = document.CreateNode(XmlNodeType.Element, "row", null); 182 183 XmlAttribute idAttr = document.CreateAttribute("label"); 184 idAttr.Value = row.RowSettings.Label; 185 columnElement.Attributes.Append(idAttr); 186 187 XmlAttribute attrColor = document.CreateAttribute("color"); 188 attrColor.Value = row.RowSettings.Color.Name; 189 columnElement.Attributes.Append(attrColor); 190 191 XmlAttribute attrYAxis = document.CreateAttribute("yAxis"); 192 attrYAxis.Value = row.YAxis.Label; 193 columnElement.Attributes.Append(attrYAxis); 194 195 StringBuilder builder = new StringBuilder(); 196 197 for (int i = 0; i < row.Count; i++) 198 { 199 if (i == 0) 200 { 201 builder.Append(row[i].ToString(CultureInfo.InvariantCulture.NumberFormat)); 202 //columnElement.InnerText += row[i].ToString(CultureInfo.InvariantCulture.NumberFormat); 203 } 204 else 205 { 206 builder.Append(";" + row[i].ToString(CultureInfo.InvariantCulture.NumberFormat)); 207 //columnElement.InnerText += ";" + row[i].ToString(CultureInfo.InvariantCulture.NumberFormat); 208 } 209 } 210 columnElement.InnerText += builder.ToString(); 211 return columnElement; 212 } 213 214 public override IDataRow FromXml(XmlNode xmlNode) 215 { 216 throw new System.NotImplementedException(); 217 } 218 176 219 private void UpdateMinMaxValue(double newValue, int oldValueIndex) { 177 220 if (minValue != dataRow[oldValueIndex] && maxValue != dataRow[oldValueIndex]) -
trunk/sources/HeuristicLab.Visualization/3.2/DataRowBase.cs
r1976 r1988 1 using System.Xml; 1 2 using HeuristicLab.Visualization.Options; 2 3 … … 128 129 public abstract double MaxValue { get; } 129 130 131 public abstract XmlNode ToXml(IDataRow row, XmlDocument document); 132 public abstract IDataRow FromXml(XmlNode xmlNode); 133 134 130 135 public event ValuesChangedHandler ValuesChanged; 131 136 -
trunk/sources/HeuristicLab.Visualization/3.2/FloatingAvgAggregator.cs
r1961 r1988 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Xml; 3 4 4 5 namespace HeuristicLab.Visualization { … … 181 182 } 182 183 184 public override XmlNode ToXml(IDataRow row, 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 183 194 #endregion 184 195 } -
trunk/sources/HeuristicLab.Visualization/3.2/IDataRow.cs
r1976 r1988 1 using System.Xml; 1 2 using HeuristicLab.Visualization.Options; 2 3 … … 35 36 double MaxValue { get; } 36 37 38 XmlNode ToXml(IDataRow row, XmlDocument document); 39 IDataRow FromXml(XmlNode xmlNode); 40 37 41 event ValuesChangedHandler ValuesChanged; 38 42 event ValueChangedHandler ValueChanged; -
trunk/sources/HeuristicLab.Visualization/3.2/MaxAggregator.cs
r1607 r1988 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Xml; 3 4 4 5 namespace HeuristicLab.Visualization { … … 115 116 } 116 117 118 public override XmlNode ToXml(IDataRow row, 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 117 128 #endregion 118 129 } -
trunk/sources/HeuristicLab.Visualization/3.2/MinAggregator.cs
r1530 r1988 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Xml; 3 4 4 5 namespace HeuristicLab.Visualization { … … 116 117 } 117 118 119 public override XmlNode ToXml(IDataRow row, 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 118 129 #endregion 119 130 }
Note: See TracChangeset
for help on using the changeset viewer.