Changeset 1993
- Timestamp:
- 06/03/09 01:42:55 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization.Test/3.2/HeuristicLab.Visualization.Test-3.2.csproj
r1882 r1993 97 97 <DependentUpon>LegendForm.cs</DependentUpon> 98 98 </Compile> 99 <Compile Include="LineChartPersistenceTests.cs" /> 99 100 <Compile Include="LineChartTestForm.cs"> 100 101 <SubType>Form</SubType> -
trunk/sources/HeuristicLab.Visualization.Test/3.2/LineChartTests.cs
r1987 r1993 358 358 359 359 f.ShowDialog(); 360 }361 362 [Test]363 public void TestPersistence() {364 LineChartTestForm f = new LineChartTestForm(model);365 366 IDataRow row1 = new DataRow();367 row1.AddValues(new double[] {0, 10, 5});368 369 IDataRow row2 = new DataRow();370 row2.AddValues(new double[] {1, 20, 7});371 372 model.AddDataRows(row1, row2);373 360 } 374 361 -
trunk/sources/HeuristicLab.Visualization/3.2/AvgAggregator.cs
r1988 r1993 148 148 } 149 149 150 public override XmlNode ToXml( IDataRow row,XmlDocument document)150 public override XmlNode ToXml(XmlDocument document) 151 151 { 152 152 throw new System.NotImplementedException(); -
trunk/sources/HeuristicLab.Visualization/3.2/AvgLineAggregator.cs
r1988 r1993 159 159 } 160 160 161 public override XmlNode ToXml( IDataRow row,XmlDocument document)161 public override XmlNode ToXml(XmlDocument document) 162 162 { 163 163 throw new System.NotImplementedException(); -
trunk/sources/HeuristicLab.Visualization/3.2/ChartDataRowsModel.cs
r1989 r1993 5 5 using System.Xml; 6 6 using HeuristicLab.Core; 7 using System.Text;8 7 using HeuristicLab.Visualization.Options; 8 using HeuristicLab.Visualization.Test; 9 9 10 10 namespace HeuristicLab.Visualization{ … … 123 123 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 124 124 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 125 126 XmlSupport.SetAttribute("Title", title, node); 125 127 126 List<YAxisDescriptor> yAx is = new List<YAxisDescriptor>();127 yAx is.Add(defaultYAxisDescriptor);128 List<YAxisDescriptor> yAxes = new List<YAxisDescriptor>(); 129 yAxes.Add(defaultYAxisDescriptor); 128 130 foreach (IDataRow row in rows) { 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 } 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 150 node.AppendChild(yAxisElement); 151 152 } 153 154 XmlNode labelProviderNode = document.ImportNode(XAxis.LabelProvider.GetLabelProviderXmlNode(), true); 155 node.AppendChild(labelProviderNode); 156 157 158 159 XmlNode modelProperties = document.CreateNode(XmlNodeType.Element, "modelProperties", null); 160 161 XmlAttribute attrTitle = document.CreateAttribute("title"); 162 attrTitle.Value = Title; 163 modelProperties.Attributes.Append(attrTitle); 164 165 166 167 node.AppendChild(modelProperties); 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 161 foreach (IDataRow row in rows) { 162 node.AppendChild(row.ToXml(document)); 163 } 164 165 node.AppendChild(XAxis.LabelProvider.GetLabelProviderXmlNode(document)); 168 166 169 167 return node; … … 173 171 base.Populate(node, restoredObjects); 174 172 175 List<YAxisDescriptor> yAxis = new List<YAxisDescriptor>(); 176 foreach (XmlNode dataRow in node.ChildNodes) 177 { 178 if (dataRow.Name.Equals("yAxis")) 179 { 180 XmlAttributeCollection attrs = dataRow.Attributes; 181 182 XmlAttribute attrYAxisLabel = (XmlAttribute)attrs.GetNamedItem("label"); 183 string axisLabel = attrYAxisLabel.Value; 184 YAxisDescriptor axis = new YAxisDescriptor(); 185 axis.Label = axisLabel; 186 yAxis.Add(axis); 187 188 XmlAttribute attrDefault = (XmlAttribute)attrs.GetNamedItem("default"); 189 if (attrDefault != null) { 190 defaultYAxisDescriptor = axis; 191 } 192 } 193 } 194 195 foreach (XmlNode dataRow in node.ChildNodes) { 196 if (dataRow.Name.Equals("modelProperties")) { 197 XmlAttributeCollection attrs = dataRow.Attributes; 198 XmlAttribute attrYAxisLabel = (XmlAttribute)attrs.GetNamedItem("title"); 199 Title = attrYAxisLabel.Value; 200 } 201 } 202 203 foreach (XmlNode dataRow in node.ChildNodes) { 204 if (dataRow.Name.Equals("LabelProvider")) { 205 XAxis.LabelProvider = XAxis.LabelProvider.PopulateLabelProviderXmlNode(dataRow); 206 } else if (dataRow.Name.Equals("row")) { 207 XmlAttributeCollection attrs = dataRow.Attributes; 208 XmlAttribute rowIdAttr = (XmlAttribute)attrs.GetNamedItem("label"); 209 string rowLabel = rowIdAttr.Value; 210 211 string rowColor = attrs.GetNamedItem("color").Value; 212 DataRow row = new DataRow(); 213 row.RowSettings.Label = rowLabel; 214 row.RowSettings.Color = Color.FromArgb(Int32.Parse(rowColor)); 215 216 string rowThickness = attrs.GetNamedItem("thickness").Value; 217 int thick; 218 Int32.TryParse(rowThickness, out thick); 219 row.RowSettings.Thickness = thick; 220 221 string yAxisLabel = attrs.GetNamedItem("yAxis").Value; 222 foreach (YAxisDescriptor axis in yAxis) { 223 if (axis.Label.Equals(yAxisLabel)) { 224 row.YAxis = axis; 225 } 226 } 227 228 string[] tokens = dataRow.InnerText.Split(';'); 229 double[] data = new double[tokens.Length]; 230 for (int i = 0; i < data.Length; i++) { 231 if (tokens[i].Length != 0) { 232 if ( 233 double.TryParse(tokens[i], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i]) == 234 false) { 235 throw new FormatException("Can't parse " + tokens[i] + " as double value."); 236 } 237 } 238 } 239 row.AddValues(data); 240 AddDataRow(row); 241 } 173 title = XmlSupport.GetAttribute("Title", "", node); 174 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; 189 } 190 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 } 199 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); 242 226 } 243 227 } -
trunk/sources/HeuristicLab.Visualization/3.2/DataRow.cs
r1989 r1993 1 1 using System; 2 using System.Drawing;3 2 using System.Collections.Generic; 4 3 using System.Globalization; 5 using System.Text;6 4 using System.Xml; 7 5 … … 23 21 private double maxValue = double.MinValue; 24 22 25 public DataRow() { 26 } 23 public DataRow() {} 27 24 28 25 public DataRow(string label) { 29 26 this.RowSettings.Label = label; 30 }31 32 public DataRow(string label, Color color, int thickness, DrawingStyle style, List<double> dataRow) {33 this.RowSettings.Label = label;34 this.RowSettings.Color = color;35 this.RowSettings.Thickness = thickness;36 this.RowSettings.Style = style;37 this.dataRow = dataRow;38 this.RowSettings.ShowMarkers = true;39 }40 41 public DataRow(string label, Color color, int thickness, DrawingStyle style, List<double> dataRow, bool showMarkers) {42 this.RowSettings.Label = label;43 this.RowSettings.Color = color;44 this.RowSettings.Thickness = thickness;45 this.RowSettings.Style = style;46 this.RowSettings.ShowMarkers = showMarkers;47 this.dataRow = dataRow;48 27 } 49 28 … … 177 156 } 178 157 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.ToArgb().ToString(); 189 columnElement.Attributes.Append(attrColor); 190 191 XmlAttribute attrThickness = document.CreateAttribute("thickness"); 192 attrThickness.Value = row.RowSettings.Thickness.ToString(); 193 columnElement.Attributes.Append(attrThickness); 194 195 XmlAttribute attrYAxis = document.CreateAttribute("yAxis"); 196 attrYAxis.Value = row.YAxis.Label; 197 columnElement.Attributes.Append(attrYAxis); 198 199 StringBuilder builder = new StringBuilder(); 200 201 for (int i = 0; i < row.Count; i++) 202 { 203 if (i == 0) 204 { 205 builder.Append(row[i].ToString(CultureInfo.InvariantCulture.NumberFormat)); 206 //columnElement.InnerText += row[i].ToString(CultureInfo.InvariantCulture.NumberFormat); 207 } 208 else 209 { 210 builder.Append(";" + row[i].ToString(CultureInfo.InvariantCulture.NumberFormat)); 211 //columnElement.InnerText += ";" + row[i].ToString(CultureInfo.InvariantCulture.NumberFormat); 212 } 213 } 214 columnElement.InnerText += builder.ToString(); 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 215 176 return columnElement; 216 177 } -
trunk/sources/HeuristicLab.Visualization/3.2/DataRowBase.cs
r1988 r1993 4 4 namespace HeuristicLab.Visualization { 5 5 public abstract class DataRowBase : IDataRow { 6 //private string label = "";7 //private Color color = Color.Black;8 //private int thickness = 2;9 // private DrawingStyle style = DrawingStyle.Solid;10 // private DataRowType lineType = DataRowType.Normal;11 6 private YAxisDescriptor yAxis; 12 // private bool showMarkers = true;13 7 14 8 private DataRowSettings rowSettings ; … … 31 25 OnDataRowChanged(this); 32 26 } 33 34 // public bool ShowMarkers {35 // get { return showMarkers; }36 // set {37 // showMarkers = value;38 // OnDataRowChanged(this);39 // }40 // }41 42 public string Label43 {44 get { return RowSettings.Label; }45 }46 //47 // public Color Color {48 // get { return color; }49 // set {50 // color = value;51 // OnDataRowChanged(this);52 // }53 // }54 //55 // public int Thickness {56 // get { return thickness; }57 // set {58 // thickness = value;59 // OnDataRowChanged(this);60 // }61 // }62 63 // public DrawingStyle Style {64 // get { return style; }65 // set {66 // style = value;67 // OnDataRowChanged(this);68 // }69 // }70 //71 // public DataRowType LineType {72 // get { return lineType; }73 // set {74 // lineType = value;75 // OnDataRowChanged(this);76 // }77 // }78 27 79 28 public YAxisDescriptor YAxis { … … 129 78 public abstract double MaxValue { get; } 130 79 131 public abstract XmlNode ToXml( IDataRow row,XmlDocument document);80 public abstract XmlNode ToXml(XmlDocument document); 132 81 public abstract IDataRow FromXml(XmlNode xmlNode); 133 82 -
trunk/sources/HeuristicLab.Visualization/3.2/FloatingAvgAggregator.cs
r1988 r1993 182 182 } 183 183 184 public override XmlNode ToXml( IDataRow row,XmlDocument document)184 public override XmlNode ToXml(XmlDocument document) 185 185 { 186 186 throw new System.NotImplementedException(); -
trunk/sources/HeuristicLab.Visualization/3.2/HeuristicLab.Visualization-3.2.csproj
r1980 r1993 124 124 <Compile Include="Options\DataRowSettings.cs" /> 125 125 <Compile Include="XAxisDescriptor.cs" /> 126 <Compile Include="XmlSupport.cs" /> 126 127 <Compile Include="YAxisGrid.cs" /> 127 128 <Compile Include="HorizontalLineShape.cs" /> -
trunk/sources/HeuristicLab.Visualization/3.2/IDataRow.cs
r1988 r1993 9 9 10 10 public interface IDataRow { 11 string Label { get; }12 //Color Color { get; set; }13 //int Thickness { get; set; }14 // DrawingStyle Style { get; set; }15 // DataRowType LineType { get; set; }16 // bool ShowMarkers { get; set; }17 11 DataRowSettings RowSettings { get; set; } 18 12 … … 36 30 double MaxValue { get; } 37 31 38 XmlNode ToXml( IDataRow row,XmlDocument document);32 XmlNode ToXml(XmlDocument document); 39 33 IDataRow FromXml(XmlNode xmlNode); 40 34 -
trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/ContinuousLabelProvider.cs
r1385 r1993 16 16 } 17 17 18 public XmlNode GetLabelProviderXmlNode( )18 public XmlNode GetLabelProviderXmlNode(XmlDocument document) 19 19 { 20 XmlDocument Xdoc = new XmlDocument(); 21 22 XmlNode lblProvInfo = Xdoc.CreateNode(XmlNodeType.Element, "LabelProvider", null); 20 XmlNode lblProvInfo = document.CreateNode(XmlNodeType.Element, "LabelProvider", null); 23 21 lblProvInfo.InnerText = "ContinuousLabelProvider"; 24 22 25 XmlAttribute idFormat = Xdoc.CreateAttribute("format");23 XmlAttribute idFormat = document.CreateAttribute("format"); 26 24 idFormat.Value = this.format; 27 25 -
trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/DiscreteLabelProvider.cs
r1385 r1993 14 14 } 15 15 16 public XmlNode GetLabelProviderXmlNode( )16 public XmlNode GetLabelProviderXmlNode(XmlDocument document) 17 17 { 18 XmlDocument Xdoc = new XmlDocument(); 19 20 XmlNode lblProvInfo = Xdoc.CreateNode(XmlNodeType.Element, "LabelProvider", null); 18 XmlNode lblProvInfo = document.CreateNode(XmlNodeType.Element, "LabelProvider", null); 21 19 lblProvInfo.InnerText = "DiscreteLabelProvider"; 22 20 -
trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/ILabelProvider.cs
r1385 r1993 4 4 public interface ILabelProvider { 5 5 string GetLabel(double value); 6 XmlNode GetLabelProviderXmlNode( );6 XmlNode GetLabelProviderXmlNode(XmlDocument document); 7 7 ILabelProvider PopulateLabelProviderXmlNode(XmlNode node); 8 8 } -
trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/StringLabelProvider.cs
r1385 r1993 1 1 using System; 2 2 using System.Collections.Generic; 3 using HeuristicLab.Visualization.LabelProvider;4 3 using System.Xml; 5 4 … … 28 27 } 29 28 30 public XmlNode GetLabelProviderXmlNode() { 31 XmlDocument Xdoc = new XmlDocument(); 32 33 XmlNode lblProvInfo = Xdoc.CreateNode(XmlNodeType.Element, "LabelProvider", null); 29 public XmlNode GetLabelProviderXmlNode(XmlDocument document) { 30 XmlNode lblProvInfo = document.CreateNode(XmlNodeType.Element, "LabelProvider", null); 34 31 lblProvInfo.InnerText = "StringLabelProvider"; 35 32 36 33 foreach (KeyValuePair<int, string> pair in labels) 37 34 { 38 XmlNode strLbl = Xdoc.CreateNode(XmlNodeType.Element, "String", null);35 XmlNode strLbl = document.CreateNode(XmlNodeType.Element, "String", null); 39 36 40 XmlAttribute idStrLbl = Xdoc.CreateAttribute("id");37 XmlAttribute idStrLbl = document.CreateAttribute("id"); 41 38 idStrLbl.Value = pair.Key.ToString(); 42 39 strLbl.Attributes.Append(idStrLbl); -
trunk/sources/HeuristicLab.Visualization/3.2/LineChart.cs
r1987 r1993 24 24 private readonly Dictionary<IDataRow, RowEntry> rowToRowEntry = new Dictionary<IDataRow, RowEntry>(); 25 25 26 private readonly ViewSettings viewSettings;27 28 26 private readonly WorldShape userInteractionShape = new WorldShape(); 29 27 private readonly RectangleShape rectangleShape = new RectangleShape(0, 0, 0, 0, Color.FromArgb(50, 0, 0, 255)); … … 55 53 56 54 this.model = model; 57 viewSettings = model.ViewSettings; 58 viewSettings.OnUpdateSettings += UpdateViewSettings; 55 this.model.ViewSettings.OnUpdateSettings += UpdateViewSettings; 59 56 60 57 Item = model; … … 87 84 /// </summary> 88 85 private void UpdateViewSettings() { 89 titleShape.Font = viewSettings.TitleFont;90 titleShape.Color = viewSettings.TitleColor;86 titleShape.Font = model.ViewSettings.TitleFont; 87 titleShape.Color = model.ViewSettings.TitleColor; 91 88 titleShape.Text = model.Title; 92 89 93 legendShape.Font = viewSettings.LegendFont;94 legendShape.Color = viewSettings.LegendColor;95 96 xAxis.Font = viewSettings.XAxisFont;97 xAxis.Color = viewSettings.XAxisColor;90 legendShape.Font = model.ViewSettings.LegendFont; 91 legendShape.Color = model.ViewSettings.LegendColor; 92 93 xAxis.Font = model.XAxis.Font; 94 xAxis.Color = model.XAxis.Color; 98 95 99 96 SetLegendPosition(); … … 242 239 /// </summary> 243 240 private void SetLegendPosition() { 244 switch ( viewSettings.LegendPosition) {241 switch (model.ViewSettings.LegendPosition) { 245 242 case LegendPosition.Bottom: 246 setLegendBottom();243 SetLegendBottom(); 247 244 break; 248 245 249 246 case LegendPosition.Top: 250 setLegendTop();247 SetLegendTop(); 251 248 break; 252 249 253 250 case LegendPosition.Left: 254 setLegendLeft();251 SetLegendLeft(); 255 252 break; 256 253 257 254 case LegendPosition.Right: 258 setLegendRight();255 SetLegendRight(); 259 256 break; 260 257 } 261 258 } 262 259 263 public void setLegendRight() { 264 // legend right 265 legendShape.BoundingBox = new RectangleD(canvasUI.Width - legendShape.GetMaxLabelLength(), 10, canvasUI.Width, 266 canvasUI.Height - 50); 260 public void SetLegendRight() { 261 legendShape.BoundingBox = new RectangleD(canvasUI.Width - legendShape.GetMaxLabelLength(), 10, canvasUI.Width, canvasUI.Height - 50); 267 262 legendShape.ClippingArea = new RectangleD(0, 0, legendShape.BoundingBox.Width, legendShape.BoundingBox.Height); 268 263 legendShape.Row = false; … … 270 265 } 271 266 272 public void setLegendLeft() { 273 // legend left 267 public void SetLegendLeft() { 274 268 legendShape.BoundingBox = new RectangleD(10, 10, canvasUI.Width, canvasUI.Height - 50); 275 269 legendShape.ClippingArea = new RectangleD(0, 0, legendShape.BoundingBox.Width, legendShape.BoundingBox.Height); 276 270 legendShape.Row = false; 277 271 legendShape.CreateLegend(); 278 279 canvasUI.Invalidate(); 280 } 281 282 public void setLegendTop() { 283 // legend top 284 legendShape.BoundingBox = new RectangleD(100, canvasUI.Height - canvasUI.Height, canvasUI.Width, 285 canvasUI.Height - 10); 272 } 273 274 public void SetLegendTop() { 275 legendShape.BoundingBox = new RectangleD(100, canvasUI.Height - canvasUI.Height, canvasUI.Width, canvasUI.Height - 10); 286 276 legendShape.ClippingArea = new RectangleD(0, 0, legendShape.BoundingBox.Width, legendShape.BoundingBox.Height); 287 277 legendShape.Row = true; … … 290 280 } 291 281 292 public void setLegendBottom() { 293 // legend bottom 282 public void SetLegendBottom() { 294 283 legendShape.BoundingBox = new RectangleD(100, 2, canvasUI.Width, canvasUI.Height); 295 284 legendShape.ClippingArea = new RectangleD(0, 0, legendShape.BoundingBox.Width, legendShape.BoundingBox.Height); -
trunk/sources/HeuristicLab.Visualization/3.2/MaxAggregator.cs
r1988 r1993 116 116 } 117 117 118 public override XmlNode ToXml( IDataRow row,XmlDocument document)118 public override XmlNode ToXml(XmlDocument document) 119 119 { 120 120 throw new System.NotImplementedException(); -
trunk/sources/HeuristicLab.Visualization/3.2/MinAggregator.cs
r1988 r1993 117 117 } 118 118 119 public override XmlNode ToXml( IDataRow row,XmlDocument document)119 public override XmlNode ToXml(XmlDocument document) 120 120 { 121 121 throw new System.NotImplementedException(); -
trunk/sources/HeuristicLab.Visualization/3.2/Options/Options.cs
r1972 r1993 15 15 private bool oldShowXAxisGrid; 16 16 private Color oldXAxisGridColor; 17 private Font oldXAxisFont; 18 private Color oldXAxisColor; 17 19 private Dictionary<CheckBox, bool> yAxisClipChangeableBoxes; 18 20 … … 69 71 model.XAxis.ShowGrid = oldShowXAxisGrid; 70 72 chkShowXAxisGrid.Checked = oldShowXAxisGrid; 73 74 model.XAxis.Color = oldXAxisColor; 75 model.XAxis.Font = oldXAxisFont; 71 76 72 77 model.XAxis.GridColor = oldXAxisGridColor; … … 93 98 viewSettings.TitleColor = oldViewSettings.TitleColor; 94 99 viewSettings.TitleFont = oldViewSettings.TitleFont; 95 viewSettings.XAxisColor = oldViewSettings.LegendColor;96 viewSettings.XAxisFont = oldViewSettings.XAxisFont;97 100 viewSettings.UpdateView(); 98 101 cbLegendPosition.SelectedItem = viewSettings.LegendPosition; … … 137 140 138 141 private void btnChangeXAxisFont_Click(object sender, EventArgs e) { 139 fdFont.Font = viewSettings.XAxisFont;140 fdFont.Color = viewSettings.XAxisColor;142 fdFont.Font = model.XAxis.Font; 143 fdFont.Color = model.XAxis.Color; 141 144 142 145 DialogResult dr = fdFont.ShowDialog(); 143 146 144 147 if (dr == DialogResult.OK) { 145 viewSettings.XAxisFont = fdFont.Font;146 viewSettings.XAxisColor = fdFont.Color;148 model.XAxis.Font = fdFont.Font; 149 model.XAxis.Color = fdFont.Color; 147 150 148 151 viewSettings.UpdateView(); … … 156 159 oldXAxisGridColor = model.XAxis.GridColor; 157 160 xAxisGridColorSelection.Color = model.XAxis.GridColor; 161 162 oldXAxisFont = model.XAxis.Font; 163 oldXAxisColor = model.XAxis.Color; 158 164 159 165 InitTabPageLines(); -
trunk/sources/HeuristicLab.Visualization/3.2/Options/OptionsDialog.Designer.cs
r1881 r1993 67 67 viewSettings1.TitleColor = System.Drawing.Color.Blue; 68 68 viewSettings1.TitleFont = new System.Drawing.Font("Arial", 8F); 69 viewSettings1.XAxisColor = System.Drawing.Color.Blue;70 viewSettings1.XAxisFont = new System.Drawing.Font("Arial", 8F);71 69 chartDataRowsModel1.ViewSettings = viewSettings1; 72 70 chartDataRowsModel1.XAxis.Label = ""; -
trunk/sources/HeuristicLab.Visualization/3.2/Options/ViewSettings.cs
r1877 r1993 10 10 private Font legendFont; 11 11 private Color legendColor; 12 private Font xAxisFont;13 private Color xAxisColor;14 12 private LegendPosition legendPosition; 15 13 … … 20 18 legendFont = new Font("Arial", 8); 21 19 legendColor = Color.Blue; 22 23 xAxisFont = new Font("Arial", 8);24 xAxisColor = Color.Blue;25 20 26 21 legendPosition = LegendPosition.Right; … … 34 29 legendFont = (Font)(src.legendFont.Clone()); 35 30 legendColor = src.LegendColor; 36 37 xAxisFont = (Font) (src.xAxisFont.Clone());38 xAxisColor = src.XAxisColor;39 31 40 32 legendPosition = src.LegendPosition; … … 67 59 } 68 60 69 public Font XAxisFont {70 get { return xAxisFont; }71 set { xAxisFont = value; }72 }73 74 public Color XAxisColor {75 get { return xAxisColor; }76 set { xAxisColor = value; }77 }78 79 61 public LegendPosition LegendPosition { 80 62 get { return legendPosition; } -
trunk/sources/HeuristicLab.Visualization/3.2/XAxis.cs
r1964 r1993 1 2 1 using System.Drawing; 3 2 using HeuristicLab.Visualization.Drawing; … … 7 6 public class XAxis : WorldShape { 8 7 public const int PixelsPerInterval = 100; 9 8 10 9 private ILabelProvider labelProvider = new ContinuousLabelProvider("0.####"); 11 10 … … 27 26 ClippingArea.X1)) { 28 27 TextShape tickLabel = new TextShape(x, ClippingArea.Height - 3, 29 labelProvider.GetLabel(x), Font, Color);28 labelProvider.GetLabel(x), Font, Color); 30 29 tickLabel.AnchorPositionX = AnchorPositionX.Middle; 31 30 tickLabel.AnchorPositionY = AnchorPositionY.Top; -
trunk/sources/HeuristicLab.Visualization/3.2/XAxisDescriptor.cs
r1885 r1993 7 7 public class XAxisDescriptor { 8 8 private string label = ""; 9 private Font font = new Font("Arial", 8); 10 private Color color = Color.Blue; 9 11 private bool showLabel = true; 10 12 private bool showGrid = true; … … 14 16 public event XAxisDescriptorChangedHandler XAxisDescriptorChanged; 15 17 18 public string Label { 19 get { return label; } 20 set { 21 label = value; 22 FireXAxisDescriptorChanged(); 23 } 24 } 25 26 public Font Font { 27 get { return font; } 28 set { 29 font = value; 30 FireXAxisDescriptorChanged(); 31 } 32 } 33 34 public Color Color { 35 get { return color; } 36 set { 37 color = value; 38 FireXAxisDescriptorChanged(); 39 } 40 } 41 42 public bool ShowLabel { 43 get { return showLabel; } 44 set { 45 showLabel = value; 46 FireXAxisDescriptorChanged(); 47 } 48 } 49 16 50 public bool ShowGrid { 17 51 get { return showGrid; } 18 52 set { 19 53 this.showGrid = value; 54 FireXAxisDescriptorChanged(); 55 } 56 } 57 58 public Color GridColor { 59 get { return this.gridColor; } 60 set { 61 this.gridColor = value; 20 62 FireXAxisDescriptorChanged(); 21 63 } … … 30 72 } 31 73 32 public string Label {33 get { return label; }34 set {35 label = value;36 FireXAxisDescriptorChanged();37 }38 }39 40 public bool ShowLabel {41 get { return showLabel; }42 set {43 showLabel = value;44 FireXAxisDescriptorChanged();45 }46 }47 48 public Color GridColor {49 get { return this.gridColor; }50 set {51 this.gridColor = value;52 FireXAxisDescriptorChanged();53 }54 }55 56 74 private void FireXAxisDescriptorChanged() { 57 75 if (XAxisDescriptorChanged != null)
Note: See TracChangeset
for help on using the changeset viewer.