Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/14/09 15:35:10 (15 years ago)
Author:
mkommend
Message:
  • added VisualMatrix to represent data in BubbleChart
  • made BubbleChart abstract and added inherited ModelingBubbleChart, which reacts as the BubbleChart
  • moved classes between CEDMA.Core and CEDMA.Charting
  • deleted unnecessary classes (results, resultsentry)

(ticket #723)

Location:
trunk/sources/HeuristicLab.CEDMA.Charting/3.3
Files:
3 added
6 edited
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChart.cs

    r2240 r2289  
    2727using HeuristicLab.Charting;
    2828using System.Windows.Forms;
    29 using HeuristicLab.CEDMA.Core;
    3029using HeuristicLab.PluginInfrastructure;
    3130using HeuristicLab.Core;
    3231using System.Diagnostics;
     32using HeuristicLab.SparseMatrix;
    3333
    3434namespace HeuristicLab.CEDMA.Charting {
    35   public class BubbleChart : Chart {
    36     private const string X_JITTER = "__X_JITTER";
    37     private const string Y_JITTER = "__Y_JITTER";
     35  public abstract class BubbleChart : Chart {
    3836    private const double maxXJitterPercent = 0.05;
    3937    private const double maxYJitterPercent = 0.05;
     
    5553    private double maxX = double.NegativeInfinity;
    5654    private double maxY = double.NegativeInfinity;
    57     private List<ResultsEntry> filteredEntries;
    58     private Results results;
    59     private Dictionary<IPrimitive, ResultsEntry> primitiveToEntryDictionary;
    60     private Random random = new Random();
    61     private Group points;
    62 
    63     public BubbleChart(Results results, PointD lowerLeft, PointD upperRight)
     55
     56    protected Group points;
     57    protected VisualMatrix matrix;
     58    protected Dictionary<IPrimitive, VisualMatrixRow> primitiveToMatrixRowDictionary;
     59
     60    public BubbleChart(VisualMatrix matrix, PointD lowerLeft, PointD upperRight)
    6461      : base(lowerLeft, upperRight) {
    65       primitiveToEntryDictionary = new Dictionary<IPrimitive, ResultsEntry>();
    66       this.results = results;
    67       filteredEntries = new List<ResultsEntry>();
    68 
    69       foreach (var resultsEntry in results.GetEntries()) {
    70         if (resultsEntry.Get(X_JITTER) == null)
    71           resultsEntry.Set(X_JITTER, random.NextDouble() * 2.0 - 1.0);
    72         if (resultsEntry.Get(Y_JITTER) == null)
    73           resultsEntry.Set(Y_JITTER, random.NextDouble() * 2.0 - 1.0);
    74       }
    75       results.Changed += new EventHandler(results_Changed);
    76     }
    77 
    78     void results_Changed(object sender, EventArgs e) {
    79       Repaint();
    80       EnforceUpdate();
    81     }
    82 
    83     public BubbleChart(Results results, double x1, double y1, double x2, double y2)
    84       : this(results, new PointD(x1, y1), new PointD(x2, y2)) {
     62      primitiveToMatrixRowDictionary = new Dictionary<IPrimitive, VisualMatrixRow>();
     63      this.matrix = matrix;
     64    }
     65
     66    public BubbleChart(VisualMatrix matrix, double x1, double y1, double x2, double y2)
     67      : this(matrix, new PointD(x1, y1), new PointD(x2, y2)) {
    8568    }
    8669
     
    10386    }
    10487
    105     internal void SetJitter(double xJitterFactor, double yJitterFactor) {
     88    public void SetJitter(double xJitterFactor, double yJitterFactor) {
    10689      this.xJitterFactor = xJitterFactor * maxXJitterPercent * Size.Width;
    10790      this.yJitterFactor = yJitterFactor * maxYJitterPercent * Size.Height;
     
    11598    }
    11699
    117     private void Repaint() {
     100    protected void Repaint() {
    118101      if (xDimension == null || yDimension == null) return;
    119102      double maxSize = 1;
    120103      double minSize = 1;
    121       if (sizeDimension != null && results.OrdinalVariables.Contains(sizeDimension)) {
    122         var sizes = results.GetEntries()
     104      if (sizeDimension != null && matrix.OrdinalVariables.Contains(sizeDimension)) {
     105        var sizes = matrix.Rows
    123106          .Select(x => Convert.ToDouble(x.Get(sizeDimension)))
    124107          .Where(size => !double.IsInfinity(size) && size != double.MaxValue && size != double.MinValue)
     
    132115      UpdateEnabled = false;
    133116      Group.Clear();
    134       primitiveToEntryDictionary.Clear();
     117      primitiveToMatrixRowDictionary.Clear();
    135118      points = new Group(this);
    136119      Group.Add(new Axis(this, 0, 0, AxisType.Both));
    137120      UpdateViewSize(0, 0, TransformPixelToWorld(new Size(5, 0)).Width);
    138       foreach (ResultsEntry r in results.GetEntries().Where(x => x.Visible)) {
     121      foreach (VisualMatrixRow r in matrix.Rows.Where(x => x.Visible)) {
    139122        List<double> xs = new List<double>();
    140123        List<double> ys = new List<double>();
     
    142125        List<object> actualYValues = new List<object>();
    143126        int size;
    144         if (results.OrdinalVariables.Contains(xDimension) && r.Get(xDimension) != null) {
    145           xs.Add(Convert.ToDouble(r.Get(xDimension)) + (double)r.Get(X_JITTER) * xJitterFactor);
     127        if (matrix.OrdinalVariables.Contains(xDimension) && r.Get(xDimension) != null) {
     128          xs.Add(Convert.ToDouble(r.Get(xDimension)) + r.XJitter * xJitterFactor);
    146129          actualXValues.Add(r.Get(xDimension));
    147         } else if (results.CategoricalVariables.Contains(xDimension) && r.Get(xDimension) != null) {
    148           xs.Add(results.IndexOfCategoricalValue(xDimension, r.Get(xDimension)) + (double)r.Get(X_JITTER) * xJitterFactor);
     130        } else if (matrix.CategoricalVariables.Contains(xDimension) && r.Get(xDimension) != null) {
     131          xs.Add(matrix.IndexOfCategoricalValue(xDimension, r.Get(xDimension)) + r.XJitter * xJitterFactor);
    149132          actualXValues.Add(r.Get(xDimension));
    150         } else if (results.MultiDimensionalCategoricalVariables.Contains(xDimension)) {
     133        } else if (matrix.MultiDimensionalCategoricalVariables.Contains(xDimension)) {
    151134          var path = xDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
    152           IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0));
    153           foreach (ResultsEntry subEntry in subEntries) {
    154             if (subEntry.Get(path.ElementAt(1)) != null) {
    155               xs.Add(results.IndexOfCategoricalValue(xDimension, subEntry.Get(path.ElementAt(1))) + (double)r.Get(X_JITTER) * xJitterFactor);
    156               actualXValues.Add(subEntry.Get(path.ElementAt(1)));
    157             }
    158           }
    159         } else if (results.MultiDimensionalOrdinalVariables.Contains(xDimension)) {
     135          IEnumerable<VisualMatrixRow> subRows = (IEnumerable<VisualMatrixRow>)r.Get(path.ElementAt(0));
     136          foreach (VisualMatrixRow subRow in subRows) {
     137            if (subRow.Get(path.ElementAt(1)) != null) {
     138              xs.Add(matrix.IndexOfCategoricalValue(xDimension, subRow.Get(path.ElementAt(1))) + r.YJitter * xJitterFactor);
     139              actualXValues.Add(subRow.Get(path.ElementAt(1)));
     140            }
     141          }
     142        } else if (matrix.MultiDimensionalOrdinalVariables.Contains(xDimension)) {
    160143          var path = xDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
    161           IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0));
    162           foreach (ResultsEntry subEntry in subEntries) {
    163             if (subEntry.Get(path.ElementAt(1)) != null) {
    164               xs.Add(Convert.ToDouble(subEntry.Get(path.ElementAt(1))) + (double)r.Get(X_JITTER) * xJitterFactor);
    165               actualXValues.Add(subEntry.Get(path.ElementAt(1)));
    166             }
    167           }
    168         }
    169         if (results.OrdinalVariables.Contains(yDimension) && r.Get(yDimension) != null) {
    170           ys.Add(Convert.ToDouble(r.Get(yDimension)) + (double)r.Get(Y_JITTER) * yJitterFactor);
     144          IEnumerable<VisualMatrixRow> subRows = (IEnumerable<VisualMatrixRow>)r.Get(path.ElementAt(0));
     145          foreach (VisualMatrixRow subRow in subRows) {
     146            if (subRow.Get(path.ElementAt(1)) != null) {
     147              xs.Add(Convert.ToDouble(subRow.Get(path.ElementAt(1))) + r.XJitter * xJitterFactor);
     148              actualXValues.Add(subRow.Get(path.ElementAt(1)));
     149            }
     150          }
     151        }
     152        if (matrix.OrdinalVariables.Contains(yDimension) && r.Get(yDimension) != null) {
     153          ys.Add(Convert.ToDouble(r.Get(yDimension)) + r.YJitter * yJitterFactor);
    171154          actualYValues.Add(r.Get(yDimension));
    172         } else if (results.CategoricalVariables.Contains(yDimension) && r.Get(yDimension) != null) {
    173           ys.Add(results.IndexOfCategoricalValue(yDimension, r.Get(yDimension)) + (double)r.Get(Y_JITTER) * yJitterFactor);
     155        } else if (matrix.CategoricalVariables.Contains(yDimension) && r.Get(yDimension) != null) {
     156          ys.Add(matrix.IndexOfCategoricalValue(yDimension, r.Get(yDimension)) + r.YJitter * yJitterFactor);
    174157          actualYValues.Add(r.Get(yDimension));
    175         } else if (results.MultiDimensionalCategoricalVariables.Contains(yDimension)) {
     158        } else if (matrix.MultiDimensionalCategoricalVariables.Contains(yDimension)) {
    176159          var path = yDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
    177           IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0));
    178           foreach (ResultsEntry subEntry in subEntries) {
    179             if (subEntry.Get(path.ElementAt(1)) != null) {
    180               ys.Add(results.IndexOfCategoricalValue(yDimension, subEntry.Get(path.ElementAt(1))) + (double)r.Get(Y_JITTER) * yJitterFactor);
    181               actualYValues.Add(subEntry.Get(path.ElementAt(1)));
    182             }
    183           }
    184         } else if (results.MultiDimensionalOrdinalVariables.Contains(yDimension)) {
     160          IEnumerable<VisualMatrixRow> subRows = (IEnumerable<VisualMatrixRow>)r.Get(path.ElementAt(0));
     161          foreach (VisualMatrixRow subRow in subRows) {
     162            if (subRow.Get(path.ElementAt(1)) != null) {
     163              ys.Add(matrix.IndexOfCategoricalValue(yDimension, subRow.Get(path.ElementAt(1))) + r.YJitter * yJitterFactor);
     164              actualYValues.Add(subRow.Get(path.ElementAt(1)));
     165            }
     166          }
     167        } else if (matrix.MultiDimensionalOrdinalVariables.Contains(yDimension)) {
    185168          var path = yDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
    186           IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0));
    187           foreach (ResultsEntry subEntry in subEntries) {
    188             if (subEntry.Get(path.ElementAt(1)) != null) {
    189               ys.Add(Convert.ToDouble(subEntry.Get(path.ElementAt(1))) + (double)r.Get(Y_JITTER) * yJitterFactor);
    190               actualYValues.Add(subEntry.Get(path.ElementAt(1)));
     169          IEnumerable<VisualMatrixRow> subRows = (IEnumerable<VisualMatrixRow>)r.Get(path.ElementAt(0));
     170          foreach (VisualMatrixRow subRow in subRows) {
     171            if (subRow.Get(path.ElementAt(1)) != null) {
     172              ys.Add(Convert.ToDouble(subRow.Get(path.ElementAt(1))) + r.YJitter * yJitterFactor);
     173              actualYValues.Add(subRow.Get(path.ElementAt(1)));
    191174            }
    192175          }
     
    208191          if (double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN;
    209192          if (double.IsInfinity(y) || y == double.MaxValue || y == double.MinValue) y = double.NaN;
    210           if (!double.IsNaN(x) && !double.IsNaN(y) && IsReasonablePoint(new PointD(x,y))) {
     193          if (!double.IsNaN(x) && !double.IsNaN(y) && IsReasonablePoint(new PointD(x, y))) {
    211194            string actualXValue = actualXValues[Math.Min(i, actualXValues.Count() - 1)].ToString();
    212195            string actualYValue = actualYValues[Math.Min(i, actualYValues.Count() - 1)].ToString();
     
    221204            points.Add(c);
    222205            if (!r.Selected) c.IntoBackground();
    223             primitiveToEntryDictionary[c] = r;
     206            primitiveToMatrixRowDictionary[c] = r;
    224207          }
    225208        }
     
    230213
    231214    private bool IsReasonablePoint(PointD pointD) {
    232       return pointD.X > LowerLeft.X && pointD.X < UpperRight.X && pointD.Y > LowerLeft.Y && pointD.Y < UpperRight.Y; 
     215      return pointD.X > LowerLeft.X && pointD.X < UpperRight.X && pointD.Y > LowerLeft.Y && pointD.Y < UpperRight.Y;
    233216    }
    234217
     
    274257    }
    275258
    276     internal ResultsEntry GetResultsEntry(Point point) {
    277       ResultsEntry r = null;
     259    protected VisualMatrixRow GetMatrixRow(Point point) {
     260      VisualMatrixRow r = null;
    278261      IPrimitive p = points.GetPrimitive(TransformPixelToWorld(point));
    279262      if (p != null) {
    280         primitiveToEntryDictionary.TryGetValue(p, out r);
     263        primitiveToMatrixRowDictionary.TryGetValue(p, out r);
    281264      }
    282265      return r;
    283266    }
    284267
    285     public override void MouseDrag(Point start, Point end, MouseButtons button) {
    286       if (button == MouseButtons.Left && Mode == ChartMode.Select) {
    287         PointD a = TransformPixelToWorld(start);
    288         PointD b = TransformPixelToWorld(end);
    289         double minX = Math.Min(a.X, b.X);
    290         double minY = Math.Min(a.Y, b.Y);
    291         double maxX = Math.Max(a.X, b.X);
    292         double maxY = Math.Max(a.Y, b.Y);
    293         HeuristicLab.Charting.Rectangle rect = new HeuristicLab.Charting.Rectangle(this, minX, minY, maxX, maxY);
    294 
    295         List<IPrimitive> primitives = new List<IPrimitive>();
    296         primitives.AddRange(points.Primitives);
    297 
    298         foreach (FixedSizeCircle p in primitives) {
    299           if (rect.ContainsPoint(p.Point)) {
    300             ResultsEntry r;
    301             primitiveToEntryDictionary.TryGetValue(p, out r);
    302             if (r != null) r.ToggleSelected();
    303           }
    304         }
    305         if (primitives.Count() > 0) results.FireChanged();
    306       } else {
    307         base.MouseDrag(start, end, button);
    308       }
    309     }
    310 
    311     public override void MouseClick(Point point, MouseButtons button) {
    312       if (button == MouseButtons.Left) {
    313         ResultsEntry r = GetResultsEntry(point);
    314         if (r != null) {
    315           r.ToggleSelected();
    316           results.FireChanged();
    317         }
    318       } else {
    319         base.MouseClick(point, button);
    320       }
    321     }
    322 
    323     public override void MouseDoubleClick(Point point, MouseButtons button) {
    324       if (button == MouseButtons.Left) {
    325         ResultsEntry entry = GetResultsEntry(point);
    326         if (entry != null) {
    327           var model = (IItem)PersistenceManager.RestoreFromGZip((byte[])entry.Get("PersistedData"));
    328           PluginManager.ControlManager.ShowControl(model.CreateView());
    329         }
    330       } else {
    331         base.MouseDoubleClick(point, button);
    332       }
    333     }
    334 
    335     internal void ToggleSelected() {
    336       foreach (ResultsEntry entry in results.GetEntries()) {
     268    public virtual void ToggleSelected() {
     269      foreach (VisualMatrixRow row in matrix.Rows) {
     270        row.ToggleSelected();
     271      }
     272      matrix.FireChanged();
     273    }
     274
     275    public virtual void ClearSelection() {
     276      foreach (VisualMatrixRow entry in matrix.Rows.Where(x => x.Selected)) {
    337277        entry.ToggleSelected();
    338278      }
    339       results.FireChanged();
    340     }
    341 
    342     internal void ClearSelection() {
    343       foreach (ResultsEntry entry in results.GetEntries().Where(x=>x.Selected)) {
    344         entry.ToggleSelected();
    345       }
    346       results.FireChanged();
    347     }
    348 
    349     internal void ApplyFilter(Func<ResultsEntry, bool> filterPred) {
    350       foreach (ResultsEntry r in results.GetEntries()) {
     279      matrix.FireChanged();
     280    }
     281
     282    public virtual void ApplyFilter(Func<VisualMatrixRow, bool> filterPred) {
     283      foreach (VisualMatrixRow r in matrix.Rows) {
    351284        if (filterPred(r)) {
    352285          r.Visible = false;
    353286          r.Selected = false;
    354           filteredEntries.Add(r);
    355         }
    356       }
    357       results.FireChanged();
    358     }
    359 
    360     internal void ClearFilter() {
    361       foreach (ResultsEntry r in filteredEntries) {
     287        }
     288      }
     289      matrix.FireChanged();
     290    }
     291
     292    public virtual void ClearFilter() {
     293      foreach (VisualMatrixRow r in matrix.Rows.Where(x => !x.Visible)) {
    362294        r.Visible = true;
    363295      }
    364       filteredEntries.Clear();
    365       results.FireChanged();
     296      matrix.FireChanged();
    366297    }
    367298  }
  • trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartControl.Designer.cs

    r2139 r2289  
    5151      this.zoomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    5252      this.selectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     53      this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
     54      this.clearSelectionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    5355      this.invertSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    5456      this.filterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     57      this.showHiddenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    5558      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    56       this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
    57       this.clearSelectionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    58       this.showHiddenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    5959      ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
    6060      this.pictureBoxContextMenuStrip.SuspendLayout();
     
    9595      this.pictureBoxContextMenuStrip.Name = "pictureBoxContextMenuStrip";
    9696      this.pictureBoxContextMenuStrip.Size = new System.Drawing.Size(155, 186);
     97      this.pictureBoxContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.pictureBoxContextMenuStrip_Opening);
    9798      //
    9899      // moveToolStripMenuItem
     
    117118      this.selectToolStripMenuItem.Click += new System.EventHandler(this.selectToolStripMenuItem_Click);
    118119      //
     120      // toolStripSeparator1
     121      //
     122      this.toolStripSeparator1.Name = "toolStripSeparator1";
     123      this.toolStripSeparator1.Size = new System.Drawing.Size(151, 6);
     124      //
     125      // clearSelectionMenuItem
     126      //
     127      this.clearSelectionMenuItem.Name = "clearSelectionMenuItem";
     128      this.clearSelectionMenuItem.Size = new System.Drawing.Size(154, 22);
     129      this.clearSelectionMenuItem.Text = "Clear selection";
     130      this.clearSelectionMenuItem.Click += new System.EventHandler(this.clearSelectionMenuItem_Click);
     131      //
    119132      // invertSelectionToolStripMenuItem
    120133      //
     
    131144      this.filterToolStripMenuItem.Click += new System.EventHandler(this.hideSelectedToolStripMenuItem_Click);
    132145      //
    133       // toolStripSeparator1
    134       //
    135       this.toolStripSeparator1.Name = "toolStripSeparator1";
    136       this.toolStripSeparator1.Size = new System.Drawing.Size(151, 6);
    137       //
    138       // clearSelectionMenuItem
    139       //
    140       this.clearSelectionMenuItem.Name = "clearSelectionMenuItem";
    141       this.clearSelectionMenuItem.Size = new System.Drawing.Size(154, 22);
    142       this.clearSelectionMenuItem.Text = "Clear selection";
    143       this.clearSelectionMenuItem.Click += new System.EventHandler(this.clearSelectionMenuItem_Click);
    144       //
    145146      // showHiddenToolStripMenuItem
    146147      //
     
    150151      this.showHiddenToolStripMenuItem.Text = "Show hidden";
    151152      this.showHiddenToolStripMenuItem.Click += new System.EventHandler(this.showHiddenToolStripMenuItem_Click);
     153      //
     154      // toolTip
     155      //
     156      this.toolTip.Popup += new System.Windows.Forms.PopupEventHandler(this.toolTip_Popup);
    152157      //
    153158      // BubbleChartControl
  • trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartControl.cs

    r2139 r2289  
    195195      showHiddenToolStripMenuItem.Enabled = false;
    196196    }
     197
     198    private void pictureBoxContextMenuStrip_Opening(object sender, CancelEventArgs e) {
     199
     200    }
     201
     202    private void toolTip_Popup(object sender, PopupEventArgs e) {
     203
     204    }
    197205  }
    198206}
  • trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartView.cs

    r2135 r2289  
    99using HeuristicLab.Core;
    1010using HeuristicLab.CEDMA.Charting;
    11 using HeuristicLab.CEDMA.Core;
    1211using HeuristicLab.PluginInfrastructure;
     12using HeuristicLab.SparseMatrix;
    1313
    1414namespace HeuristicLab.CEDMA.Charting {
    1515  public partial class BubbleChartView : ViewBase {
    16     private Results Results {
    17       get { return (Results)Item; }
    18       set { Item = value; }
    19     }
    2016    private const string CONSTANT_SIZE = "<constant>";
    2117    private Label pleaseSelectAxisLabel = new Label();
    22     public BubbleChartView(Results results) {
     18    public BubbleChartView(VisualMatrix results) {
    2319      InitializeComponent();
    24       Results = results;
    25       bubbleChartControl.Chart = new BubbleChart(Results, 0, 0, 100, 100);
    26       xAxisComboBox.Items.AddRange(Results.OrdinalVariables);
    27       xAxisComboBox.Items.AddRange(Results.CategoricalVariables);
    28       xAxisComboBox.Items.AddRange(Results.MultiDimensionalCategoricalVariables);
    29       xAxisComboBox.Items.AddRange(Results.MultiDimensionalOrdinalVariables);
    30       yAxisComboBox.Items.AddRange(Results.OrdinalVariables);
    31       yAxisComboBox.Items.AddRange(Results.CategoricalVariables);
    32       yAxisComboBox.Items.AddRange(Results.MultiDimensionalCategoricalVariables);
    33       yAxisComboBox.Items.AddRange(Results.MultiDimensionalOrdinalVariables);
     20      bubbleChartControl.Chart = new ModelingBubbleChart(results, 0, 0, 100, 100);
     21      xAxisComboBox.Items.AddRange(results.OrdinalVariables);
     22      xAxisComboBox.Items.AddRange(results.CategoricalVariables);
     23      xAxisComboBox.Items.AddRange(results.MultiDimensionalCategoricalVariables);
     24      xAxisComboBox.Items.AddRange(results.MultiDimensionalOrdinalVariables);
     25      yAxisComboBox.Items.AddRange(results.OrdinalVariables);
     26      yAxisComboBox.Items.AddRange(results.CategoricalVariables);
     27      yAxisComboBox.Items.AddRange(results.MultiDimensionalCategoricalVariables);
     28      yAxisComboBox.Items.AddRange(results.MultiDimensionalOrdinalVariables);
    3429      sizeComboBox.Items.Add(CONSTANT_SIZE);
    35       sizeComboBox.Items.AddRange(Results.OrdinalVariables);
     30      sizeComboBox.Items.AddRange(results.OrdinalVariables);
    3631      sizeComboBox.SelectedItem = sizeComboBox.Items[0];
    3732      yAxisComboBox.SelectedItem = yAxisComboBox.Items[0];
     
    6863    }
    6964
    70     public IControl CreateView(Results results) {
     65    public IControl CreateView(VisualMatrix results) {
    7166      return new BubbleChartView(results);
    7267    }
  • trunk/sources/HeuristicLab.CEDMA.Charting/3.3/HeuristicLab.CEDMA.Charting-3.3.csproj

    r2240 r2289  
    9696    </Compile>
    9797    <Compile Include="HeuristicLabCedmaChartingPlugin.cs" />
     98    <Compile Include="IResultsViewFactory.cs" />
     99    <Compile Include="ModelingBubbleChart.cs" />
    98100    <Compile Include="Properties\AssemblyInfo.cs" />
     101    <Compile Include="TableResultsView.cs">
     102      <SubType>UserControl</SubType>
     103    </Compile>
     104    <Compile Include="TableResultsView.Designer.cs">
     105      <DependentUpon>TableResultsView.cs</DependentUpon>
     106    </Compile>
     107    <Compile Include="VisualMatrix.cs" />
     108    <Compile Include="VisualMatrixRow.cs" />
    99109  </ItemGroup>
    100110  <ItemGroup>
    101     <ProjectReference Include="..\..\HeuristicLab.CEDMA.Core\3.3\HeuristicLab.CEDMA.Core-3.3.csproj">
    102       <Project>{C27DDF6C-84DF-45EF-B82F-57A28DD51166}</Project>
    103       <Name>HeuristicLab.CEDMA.Core-3.3</Name>
    104     </ProjectReference>
    105111    <ProjectReference Include="..\..\HeuristicLab.Charting.Data\3.2\HeuristicLab.Charting.Data-3.2.csproj">
    106112      <Project>{E0740131-AA3E-4A3F-BA03-C9FF8327F4EE}</Project>
     
    119125      <Name>HeuristicLab.PluginInfrastructure</Name>
    120126    </ProjectReference>
     127    <ProjectReference Include="..\..\HeuristicLab.SparseMatrix\3.2\HeuristicLab.SparseMatrix-3.2.csproj">
     128      <Project>{1263BB36-1F20-4960-A5CB-530746DBAD77}</Project>
     129      <Name>HeuristicLab.SparseMatrix-3.2</Name>
     130    </ProjectReference>
    121131  </ItemGroup>
    122132  <ItemGroup>
     
    130140    <EmbeddedResource Include="BubbleChartView.resx">
    131141      <DependentUpon>BubbleChartView.cs</DependentUpon>
     142    </EmbeddedResource>
     143    <EmbeddedResource Include="TableResultsView.resx">
     144      <DependentUpon>TableResultsView.cs</DependentUpon>
    132145    </EmbeddedResource>
    133146  </ItemGroup>
  • trunk/sources/HeuristicLab.CEDMA.Charting/3.3/HeuristicLabCedmaChartingPlugin.cs

    r2240 r2289  
    2828  [ClassInfo(Name = "HeuristicLab.CEDMA.Charting-3.3")]
    2929  [PluginFile(Filename = "HeuristicLab.CEDMA.Charting-3.3.dll", Filetype = PluginFileType.Assembly)]
    30   [Dependency(Dependency = "HeuristicLab.CEDMA.Core-3.3")]
    3130  [Dependency(Dependency = "HeuristicLab.Charting-3.2")]
    3231  [Dependency(Dependency = "HeuristicLab.Charting.Data-3.2")]
    3332  [Dependency(Dependency = "HeuristicLab.Core-3.2")]
    3433  [Dependency(Dependency = "HeuristicLab.Data-3.2")]
     34  [Dependency(Dependency = "HeuristicLab.SparseMatrix-3.2")]
    3535  public class HeuristicLabCedmaCorePlugin : PluginBase {
    3636  }
  • trunk/sources/HeuristicLab.CEDMA.Charting/3.3/IResultsViewFactory.cs

    r2279 r2289  
    2626using HeuristicLab.Core;
    2727using System.Xml;
    28 using HeuristicLab.Operators;
    2928using System.Windows.Forms;
    3029using HeuristicLab.PluginInfrastructure;
    3130
    32 namespace HeuristicLab.CEDMA.Core {
     31namespace HeuristicLab.CEDMA.Charting {
    3332  public interface IResultsViewFactory {
    3433    string Name { get; }
    35     IControl CreateView(Results results);
     34    IControl CreateView(VisualMatrix results);
    3635  }
    3736}
  • trunk/sources/HeuristicLab.CEDMA.Charting/3.3/TableResultsView.cs

    r2279 r2289  
    1010using HeuristicLab.CEDMA.Core;
    1111using HeuristicLab.PluginInfrastructure;
     12using HeuristicLab.CEDMA.Charting;
    1213
    1314namespace HeuristicLab.CEDMA.Core {
    1415
    1516  public partial class TableResultsView : ViewBase {
    16     private Results Results {
    17       get { return (Results)Item; }
     17    private VisualMatrix VisualMatrix {
     18      get { return (VisualMatrix)Item; }
    1819      set { Item = value; }
    1920    }
    2021    private bool suppressEvents;
    21     public TableResultsView(Results results) {
     22    public TableResultsView(VisualMatrix visualMatrix) {
    2223      suppressEvents = false;
    2324      InitializeComponent();
    24       Results = results;
    25       results.Changed += new EventHandler(results_Changed);
     25      VisualMatrix = visualMatrix;
     26      VisualMatrix.Changed += new EventHandler(VisualMatrixChanged);
    2627    }
    2728
    28     void results_Changed(object sender, EventArgs e) {
     29    private void VisualMatrixChanged(object sender, EventArgs e) {
    2930      if (suppressEvents) return;
    3031      UpdateControls();
     
    3536      dataGridView.Rows.Clear();
    3637      dataGridView.Columns.Clear();
    37       List<string> attributeNames = Results.SelectModelAttributes().ToList();
    38       foreach (var attribute in attributeNames) {
     38      foreach (var attribute in VisualMatrix.Attributes) {
    3939        dataGridView.Columns.Add(attribute, attribute);
    4040      }
    4141
    42       var entries = Results.GetEntries();
    43       foreach (var entry in entries) {
    44         if (entry.Visible) {
     42      foreach (var row in VisualMatrix.Rows) {
     43        if (row.Visible) {
    4544          int rowIndex = dataGridView.Rows.Add();
    46           dataGridView.Rows[rowIndex].Tag = entry;
    47           foreach (string attrName in attributeNames) {
    48             dataGridView.Rows[rowIndex].Cells[attrName].Value = entry.Get(attrName);
     45          dataGridView.Rows[rowIndex].Tag = row;
     46          foreach (string attrName in VisualMatrix.Attributes) {
     47            dataGridView.Rows[rowIndex].Cells[attrName].Value = row.Get(attrName);
    4948          }
    50           if (entry.Selected) dataGridView.Rows[rowIndex].Selected = true;
     49          if (row.Selected) dataGridView.Rows[rowIndex].Selected = true;
    5150        }
    5251      }
     
    5857      if (suppressEvents) return;
    5958      foreach (DataGridViewRow row in dataGridView.Rows) {
    60         ((ResultsEntry)row.Tag).Selected = row.Selected;
     59        ((VisualMatrixRow)row.Tag).Selected = row.Selected;
    6160      }
    6261      suppressEvents = true;
    63       Results.FireChanged();
     62      VisualMatrix.FireChanged();
    6463      suppressEvents = false;
    6564    }
     
    6867      if (e.Button == MouseButtons.Left && e.Clicks == 2) {
    6968        DataGridView.HitTestInfo hitInfo = dataGridView.HitTest(e.X, e.Y);
    70         ResultsEntry entry = (ResultsEntry)dataGridView.Rows[hitInfo.RowIndex].Tag;       
     69        VisualMatrixRow entry = (VisualMatrixRow)dataGridView.Rows[hitInfo.RowIndex].Tag;       
    7170        var model = (IItem)PersistenceManager.RestoreFromGZip((byte[])entry.Get("PersistedData"));
    7271        PluginManager.ControlManager.ShowControl(model.CreateView());
     
    8281    }
    8382
    84     public IControl CreateView(Results results) {
    85       return new TableResultsView(results);
     83    public IControl CreateView(VisualMatrix matrix) {
     84      return new TableResultsView(matrix);
    8685    }
    8786
Note: See TracChangeset for help on using the changeset viewer.