Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1993 for trunk/sources


Ignore:
Timestamp:
06/03/09 01:42:55 (15 years ago)
Author:
mstoeger
Message:

added many new persisted properties.
removed useless comments.
added XmlSupport class since the code for setting xml attributes is always the same.
#639

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  
    9797      <DependentUpon>LegendForm.cs</DependentUpon>
    9898    </Compile>
     99    <Compile Include="LineChartPersistenceTests.cs" />
    99100    <Compile Include="LineChartTestForm.cs">
    100101      <SubType>Form</SubType>
  • trunk/sources/HeuristicLab.Visualization.Test/3.2/LineChartTests.cs

    r1987 r1993  
    358358
    359359      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);
    373360    }
    374361
  • trunk/sources/HeuristicLab.Visualization/3.2/AvgAggregator.cs

    r1988 r1993  
    148148    }
    149149
    150     public override XmlNode ToXml(IDataRow row, XmlDocument document)
     150    public override XmlNode ToXml(XmlDocument document)
    151151    {
    152152      throw new System.NotImplementedException();
  • trunk/sources/HeuristicLab.Visualization/3.2/AvgLineAggregator.cs

    r1988 r1993  
    159159    }
    160160
    161     public override XmlNode ToXml(IDataRow row, XmlDocument document)
     161    public override XmlNode ToXml(XmlDocument document)
    162162    {
    163163      throw new System.NotImplementedException();
  • trunk/sources/HeuristicLab.Visualization/3.2/ChartDataRowsModel.cs

    r1989 r1993  
    55using System.Xml;
    66using HeuristicLab.Core;
    7 using System.Text;
    87using HeuristicLab.Visualization.Options;
     8using HeuristicLab.Visualization.Test;
    99
    1010namespace HeuristicLab.Visualization{
     
    123123    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    124124      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     125
     126      XmlSupport.SetAttribute("Title", title, node);
    125127     
    126       List<YAxisDescriptor> yAxis = new List<YAxisDescriptor>();
    127       yAxis.Add(defaultYAxisDescriptor);
     128      List<YAxisDescriptor> yAxes = new List<YAxisDescriptor>();
     129      yAxes.Add(defaultYAxisDescriptor);
    128130      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
    150150        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));
    168166
    169167      return node;
     
    173171      base.Populate(node, restoredObjects);
    174172
    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);
    242226      }
    243227    }
  • trunk/sources/HeuristicLab.Visualization/3.2/DataRow.cs

    r1989 r1993  
    11using System;
    2 using System.Drawing;
    32using System.Collections.Generic;
    43using System.Globalization;
    5 using System.Text;
    64using System.Xml;
    75
     
    2321    private double maxValue = double.MinValue;
    2422
    25     public DataRow() {
    26     }
     23    public DataRow() {}
    2724   
    2825    public DataRow(string label) {
    2926      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;
    4827    }
    4928
     
    177156    }
    178157
    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
    215176      return columnElement;
    216177    }
  • trunk/sources/HeuristicLab.Visualization/3.2/DataRowBase.cs

    r1988 r1993  
    44namespace HeuristicLab.Visualization {
    55  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;
    116    private YAxisDescriptor yAxis;
    12 //    private bool showMarkers = true;
    137
    148    private DataRowSettings rowSettings ;
     
    3125      OnDataRowChanged(this);
    3226    }
    33 
    34 //    public bool ShowMarkers {
    35 //      get { return showMarkers; }
    36 //      set {
    37 //        showMarkers = value;
    38 //        OnDataRowChanged(this);
    39 //      }
    40 //    }         
    41 
    42     public string Label
    43     {
    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 //    }
    7827
    7928    public YAxisDescriptor YAxis {
     
    12978    public abstract double MaxValue { get; }
    13079
    131     public abstract XmlNode ToXml(IDataRow row, XmlDocument document);
     80    public abstract XmlNode ToXml(XmlDocument document);
    13281    public abstract IDataRow FromXml(XmlNode xmlNode);
    13382   
  • trunk/sources/HeuristicLab.Visualization/3.2/FloatingAvgAggregator.cs

    r1988 r1993  
    182182    }
    183183
    184     public override XmlNode ToXml(IDataRow row, XmlDocument document)
     184    public override XmlNode ToXml(XmlDocument document)
    185185    {
    186186      throw new System.NotImplementedException();
  • trunk/sources/HeuristicLab.Visualization/3.2/HeuristicLab.Visualization-3.2.csproj

    r1980 r1993  
    124124    <Compile Include="Options\DataRowSettings.cs" />
    125125    <Compile Include="XAxisDescriptor.cs" />
     126    <Compile Include="XmlSupport.cs" />
    126127    <Compile Include="YAxisGrid.cs" />
    127128    <Compile Include="HorizontalLineShape.cs" />
  • trunk/sources/HeuristicLab.Visualization/3.2/IDataRow.cs

    r1988 r1993  
    99
    1010  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; }
    1711    DataRowSettings RowSettings { get; set; }
    1812 
     
    3630    double MaxValue { get; }
    3731
    38     XmlNode ToXml(IDataRow row, XmlDocument document);
     32    XmlNode ToXml(XmlDocument document);
    3933    IDataRow FromXml(XmlNode xmlNode);
    4034
  • trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/ContinuousLabelProvider.cs

    r1385 r1993  
    1616    }
    1717
    18     public XmlNode GetLabelProviderXmlNode()
     18    public XmlNode GetLabelProviderXmlNode(XmlDocument document)
    1919    {
    20       XmlDocument Xdoc = new XmlDocument();
    21 
    22       XmlNode lblProvInfo = Xdoc.CreateNode(XmlNodeType.Element, "LabelProvider", null);
     20      XmlNode lblProvInfo = document.CreateNode(XmlNodeType.Element, "LabelProvider", null);
    2321      lblProvInfo.InnerText = "ContinuousLabelProvider";
    2422
    25       XmlAttribute idFormat = Xdoc.CreateAttribute("format");
     23      XmlAttribute idFormat = document.CreateAttribute("format");
    2624      idFormat.Value = this.format;
    2725
  • trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/DiscreteLabelProvider.cs

    r1385 r1993  
    1414    }
    1515
    16     public XmlNode GetLabelProviderXmlNode()
     16    public XmlNode GetLabelProviderXmlNode(XmlDocument document)
    1717    {
    18       XmlDocument Xdoc = new XmlDocument();
    19 
    20       XmlNode lblProvInfo = Xdoc.CreateNode(XmlNodeType.Element, "LabelProvider", null);
     18      XmlNode lblProvInfo = document.CreateNode(XmlNodeType.Element, "LabelProvider", null);
    2119      lblProvInfo.InnerText = "DiscreteLabelProvider";
    2220
  • trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/ILabelProvider.cs

    r1385 r1993  
    44  public interface ILabelProvider {
    55    string GetLabel(double value);
    6     XmlNode GetLabelProviderXmlNode();
     6    XmlNode GetLabelProviderXmlNode(XmlDocument document);
    77    ILabelProvider PopulateLabelProviderXmlNode(XmlNode node);
    88  }
  • trunk/sources/HeuristicLab.Visualization/3.2/LabelProvider/StringLabelProvider.cs

    r1385 r1993  
    11using System;
    22using System.Collections.Generic;
    3 using HeuristicLab.Visualization.LabelProvider;
    43using System.Xml;
    54
     
    2827    }
    2928
    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);
    3431      lblProvInfo.InnerText = "StringLabelProvider";
    3532
    3633      foreach (KeyValuePair<int, string> pair in labels)
    3734      {
    38         XmlNode strLbl = Xdoc.CreateNode(XmlNodeType.Element, "String", null);
     35        XmlNode strLbl = document.CreateNode(XmlNodeType.Element, "String", null);
    3936
    40         XmlAttribute idStrLbl = Xdoc.CreateAttribute("id");
     37        XmlAttribute idStrLbl = document.CreateAttribute("id");
    4138        idStrLbl.Value = pair.Key.ToString();
    4239        strLbl.Attributes.Append(idStrLbl);
  • trunk/sources/HeuristicLab.Visualization/3.2/LineChart.cs

    r1987 r1993  
    2424    private readonly Dictionary<IDataRow, RowEntry> rowToRowEntry = new Dictionary<IDataRow, RowEntry>();
    2525
    26     private readonly ViewSettings viewSettings;
    27 
    2826    private readonly WorldShape userInteractionShape = new WorldShape();
    2927    private readonly RectangleShape rectangleShape = new RectangleShape(0, 0, 0, 0, Color.FromArgb(50, 0, 0, 255));
     
    5553
    5654      this.model = model;
    57       viewSettings = model.ViewSettings;
    58       viewSettings.OnUpdateSettings += UpdateViewSettings;
     55      this.model.ViewSettings.OnUpdateSettings += UpdateViewSettings;
    5956
    6057      Item = model;
     
    8784    /// </summary>
    8885    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;
    9188      titleShape.Text = model.Title;
    9289
    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;
    9895
    9996      SetLegendPosition();
     
    242239    /// </summary>
    243240    private void SetLegendPosition() {
    244       switch (viewSettings.LegendPosition) {
     241      switch (model.ViewSettings.LegendPosition) {
    245242        case LegendPosition.Bottom:
    246           setLegendBottom();
     243          SetLegendBottom();
    247244          break;
    248245
    249246        case LegendPosition.Top:
    250           setLegendTop();
     247          SetLegendTop();
    251248          break;
    252249
    253250        case LegendPosition.Left:
    254           setLegendLeft();
     251          SetLegendLeft();
    255252          break;
    256253
    257254        case LegendPosition.Right:
    258           setLegendRight();
     255          SetLegendRight();
    259256          break;
    260257      }
    261258    }
    262259
    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);
    267262      legendShape.ClippingArea = new RectangleD(0, 0, legendShape.BoundingBox.Width, legendShape.BoundingBox.Height);
    268263      legendShape.Row = false;
     
    270265    }
    271266
    272     public void setLegendLeft() {
    273       // legend left
     267    public void SetLegendLeft() {
    274268      legendShape.BoundingBox = new RectangleD(10, 10, canvasUI.Width, canvasUI.Height - 50);
    275269      legendShape.ClippingArea = new RectangleD(0, 0, legendShape.BoundingBox.Width, legendShape.BoundingBox.Height);
    276270      legendShape.Row = false;
    277271      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);
    286276      legendShape.ClippingArea = new RectangleD(0, 0, legendShape.BoundingBox.Width, legendShape.BoundingBox.Height);
    287277      legendShape.Row = true;
     
    290280    }
    291281
    292     public void setLegendBottom() {
    293       // legend bottom
     282    public void SetLegendBottom() {
    294283      legendShape.BoundingBox = new RectangleD(100, 2, canvasUI.Width, canvasUI.Height);
    295284      legendShape.ClippingArea = new RectangleD(0, 0, legendShape.BoundingBox.Width, legendShape.BoundingBox.Height);
  • trunk/sources/HeuristicLab.Visualization/3.2/MaxAggregator.cs

    r1988 r1993  
    116116    }
    117117
    118     public override XmlNode ToXml(IDataRow row, XmlDocument document)
     118    public override XmlNode ToXml(XmlDocument document)
    119119    {
    120120      throw new System.NotImplementedException();
  • trunk/sources/HeuristicLab.Visualization/3.2/MinAggregator.cs

    r1988 r1993  
    117117    }
    118118
    119     public override XmlNode ToXml(IDataRow row, XmlDocument document)
     119    public override XmlNode ToXml(XmlDocument document)
    120120    {
    121121      throw new System.NotImplementedException();
  • trunk/sources/HeuristicLab.Visualization/3.2/Options/Options.cs

    r1972 r1993  
    1515    private bool oldShowXAxisGrid;
    1616    private Color oldXAxisGridColor;
     17    private Font oldXAxisFont;
     18    private Color oldXAxisColor;
    1719    private Dictionary<CheckBox, bool> yAxisClipChangeableBoxes;
    1820
     
    6971      model.XAxis.ShowGrid = oldShowXAxisGrid;
    7072      chkShowXAxisGrid.Checked = oldShowXAxisGrid;
     73
     74      model.XAxis.Color = oldXAxisColor;
     75      model.XAxis.Font = oldXAxisFont;
    7176     
    7277      model.XAxis.GridColor = oldXAxisGridColor;
     
    9398      viewSettings.TitleColor = oldViewSettings.TitleColor;
    9499      viewSettings.TitleFont = oldViewSettings.TitleFont;
    95       viewSettings.XAxisColor = oldViewSettings.LegendColor;
    96       viewSettings.XAxisFont = oldViewSettings.XAxisFont;
    97100      viewSettings.UpdateView();
    98101      cbLegendPosition.SelectedItem = viewSettings.LegendPosition;
     
    137140
    138141    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;
    141144
    142145      DialogResult dr = fdFont.ShowDialog();
    143146
    144147      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;
    147150
    148151        viewSettings.UpdateView();
     
    156159      oldXAxisGridColor = model.XAxis.GridColor;
    157160      xAxisGridColorSelection.Color = model.XAxis.GridColor;
     161
     162      oldXAxisFont = model.XAxis.Font;
     163      oldXAxisColor = model.XAxis.Color;
    158164
    159165      InitTabPageLines();
  • trunk/sources/HeuristicLab.Visualization/3.2/Options/OptionsDialog.Designer.cs

    r1881 r1993  
    6767      viewSettings1.TitleColor = System.Drawing.Color.Blue;
    6868      viewSettings1.TitleFont = new System.Drawing.Font("Arial", 8F);
    69       viewSettings1.XAxisColor = System.Drawing.Color.Blue;
    70       viewSettings1.XAxisFont = new System.Drawing.Font("Arial", 8F);
    7169      chartDataRowsModel1.ViewSettings = viewSettings1;
    7270      chartDataRowsModel1.XAxis.Label = "";
  • trunk/sources/HeuristicLab.Visualization/3.2/Options/ViewSettings.cs

    r1877 r1993  
    1010    private Font legendFont;
    1111    private Color legendColor;
    12     private Font xAxisFont;
    13     private Color xAxisColor;
    1412    private LegendPosition legendPosition;
    1513
     
    2018      legendFont = new Font("Arial", 8);
    2119      legendColor = Color.Blue;
    22 
    23       xAxisFont = new Font("Arial", 8);
    24       xAxisColor = Color.Blue;
    2520
    2621      legendPosition = LegendPosition.Right;
     
    3429      legendFont = (Font)(src.legendFont.Clone());
    3530      legendColor = src.LegendColor;
    36 
    37       xAxisFont = (Font) (src.xAxisFont.Clone());
    38       xAxisColor = src.XAxisColor;
    3931
    4032      legendPosition = src.LegendPosition;
     
    6759    }
    6860
    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 
    7961    public LegendPosition LegendPosition {
    8062      get { return legendPosition; }
  • trunk/sources/HeuristicLab.Visualization/3.2/XAxis.cs

    r1964 r1993  
    1 
    21using System.Drawing;
    32using HeuristicLab.Visualization.Drawing;
     
    76  public class XAxis : WorldShape {
    87    public const int PixelsPerInterval = 100;
    9    
     8
    109    private ILabelProvider labelProvider = new ContinuousLabelProvider("0.####");
    1110
     
    2726                                              ClippingArea.X1)) {
    2827        TextShape tickLabel = new TextShape(x, ClippingArea.Height - 3,
    29                                         labelProvider.GetLabel(x), Font, Color);
     28                                            labelProvider.GetLabel(x), Font, Color);
    3029        tickLabel.AnchorPositionX = AnchorPositionX.Middle;
    3130        tickLabel.AnchorPositionY = AnchorPositionY.Top;
  • trunk/sources/HeuristicLab.Visualization/3.2/XAxisDescriptor.cs

    r1885 r1993  
    77  public class XAxisDescriptor {
    88    private string label = "";
     9    private Font font = new Font("Arial", 8);
     10    private Color color = Color.Blue;
    911    private bool showLabel = true;
    1012    private bool showGrid = true;
     
    1416    public event XAxisDescriptorChangedHandler XAxisDescriptorChanged;
    1517
     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
    1650    public bool ShowGrid {
    1751      get { return showGrid; }
    1852      set {
    1953        this.showGrid = value;
     54        FireXAxisDescriptorChanged();
     55      }
     56    }
     57
     58    public Color GridColor {
     59      get { return this.gridColor; }
     60      set {
     61        this.gridColor = value;
    2062        FireXAxisDescriptorChanged();
    2163      }
     
    3072    }
    3173
    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 
    5674    private void FireXAxisDescriptorChanged() {
    5775      if (XAxisDescriptorChanged != null)
Note: See TracChangeset for help on using the changeset viewer.