Changeset 2289 for trunk/sources/HeuristicLab.CEDMA.Charting
- Timestamp:
- 08/14/09 15:35:10 (15 years ago)
- 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 27 27 using HeuristicLab.Charting; 28 28 using System.Windows.Forms; 29 using HeuristicLab.CEDMA.Core;30 29 using HeuristicLab.PluginInfrastructure; 31 30 using HeuristicLab.Core; 32 31 using System.Diagnostics; 32 using HeuristicLab.SparseMatrix; 33 33 34 34 namespace 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 { 38 36 private const double maxXJitterPercent = 0.05; 39 37 private const double maxYJitterPercent = 0.05; … … 55 53 private double maxX = double.NegativeInfinity; 56 54 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) 64 61 : 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)) { 85 68 } 86 69 … … 103 86 } 104 87 105 internalvoid SetJitter(double xJitterFactor, double yJitterFactor) {88 public void SetJitter(double xJitterFactor, double yJitterFactor) { 106 89 this.xJitterFactor = xJitterFactor * maxXJitterPercent * Size.Width; 107 90 this.yJitterFactor = yJitterFactor * maxYJitterPercent * Size.Height; … … 115 98 } 116 99 117 pr ivatevoid Repaint() {100 protected void Repaint() { 118 101 if (xDimension == null || yDimension == null) return; 119 102 double maxSize = 1; 120 103 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 123 106 .Select(x => Convert.ToDouble(x.Get(sizeDimension))) 124 107 .Where(size => !double.IsInfinity(size) && size != double.MaxValue && size != double.MinValue) … … 132 115 UpdateEnabled = false; 133 116 Group.Clear(); 134 primitiveTo EntryDictionary.Clear();117 primitiveToMatrixRowDictionary.Clear(); 135 118 points = new Group(this); 136 119 Group.Add(new Axis(this, 0, 0, AxisType.Both)); 137 120 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)) { 139 122 List<double> xs = new List<double>(); 140 123 List<double> ys = new List<double>(); … … 142 125 List<object> actualYValues = new List<object>(); 143 126 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); 146 129 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); 149 132 actualXValues.Add(r.Get(xDimension)); 150 } else if ( results.MultiDimensionalCategoricalVariables.Contains(xDimension)) {133 } else if (matrix.MultiDimensionalCategoricalVariables.Contains(xDimension)) { 151 134 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 (sub Entry.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(sub Entry.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)) { 160 143 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 (sub Entry.Get(path.ElementAt(1)) != null) {164 xs.Add(Convert.ToDouble(sub Entry.Get(path.ElementAt(1))) + (double)r.Get(X_JITTER)* xJitterFactor);165 actualXValues.Add(sub Entry.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); 171 154 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); 174 157 actualYValues.Add(r.Get(yDimension)); 175 } else if ( results.MultiDimensionalCategoricalVariables.Contains(yDimension)) {158 } else if (matrix.MultiDimensionalCategoricalVariables.Contains(yDimension)) { 176 159 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 (sub Entry.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(sub Entry.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)) { 185 168 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 (sub Entry.Get(path.ElementAt(1)) != null) {189 ys.Add(Convert.ToDouble(sub Entry.Get(path.ElementAt(1))) + (double)r.Get(Y_JITTER)* yJitterFactor);190 actualYValues.Add(sub Entry.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))); 191 174 } 192 175 } … … 208 191 if (double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN; 209 192 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))) { 211 194 string actualXValue = actualXValues[Math.Min(i, actualXValues.Count() - 1)].ToString(); 212 195 string actualYValue = actualYValues[Math.Min(i, actualYValues.Count() - 1)].ToString(); … … 221 204 points.Add(c); 222 205 if (!r.Selected) c.IntoBackground(); 223 primitiveTo EntryDictionary[c] = r;206 primitiveToMatrixRowDictionary[c] = r; 224 207 } 225 208 } … … 230 213 231 214 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; 233 216 } 234 217 … … 274 257 } 275 258 276 internal ResultsEntry GetResultsEntry(Point point) {277 ResultsEntryr = null;259 protected VisualMatrixRow GetMatrixRow(Point point) { 260 VisualMatrixRow r = null; 278 261 IPrimitive p = points.GetPrimitive(TransformPixelToWorld(point)); 279 262 if (p != null) { 280 primitiveTo EntryDictionary.TryGetValue(p, out r);263 primitiveToMatrixRowDictionary.TryGetValue(p, out r); 281 264 } 282 265 return r; 283 266 } 284 267 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)) { 337 277 entry.ToggleSelected(); 338 278 } 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) { 351 284 if (filterPred(r)) { 352 285 r.Visible = false; 353 286 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)) { 362 294 r.Visible = true; 363 295 } 364 filteredEntries.Clear(); 365 results.FireChanged(); 296 matrix.FireChanged(); 366 297 } 367 298 } -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartControl.Designer.cs
r2139 r2289 51 51 this.zoomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 52 52 this.selectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 54 this.clearSelectionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 55 this.invertSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 54 56 this.filterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 57 this.showHiddenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 55 58 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();59 59 ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); 60 60 this.pictureBoxContextMenuStrip.SuspendLayout(); … … 95 95 this.pictureBoxContextMenuStrip.Name = "pictureBoxContextMenuStrip"; 96 96 this.pictureBoxContextMenuStrip.Size = new System.Drawing.Size(155, 186); 97 this.pictureBoxContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.pictureBoxContextMenuStrip_Opening); 97 98 // 98 99 // moveToolStripMenuItem … … 117 118 this.selectToolStripMenuItem.Click += new System.EventHandler(this.selectToolStripMenuItem_Click); 118 119 // 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 // 119 132 // invertSelectionToolStripMenuItem 120 133 // … … 131 144 this.filterToolStripMenuItem.Click += new System.EventHandler(this.hideSelectedToolStripMenuItem_Click); 132 145 // 133 // toolStripSeparator1134 //135 this.toolStripSeparator1.Name = "toolStripSeparator1";136 this.toolStripSeparator1.Size = new System.Drawing.Size(151, 6);137 //138 // clearSelectionMenuItem139 //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 //145 146 // showHiddenToolStripMenuItem 146 147 // … … 150 151 this.showHiddenToolStripMenuItem.Text = "Show hidden"; 151 152 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); 152 157 // 153 158 // BubbleChartControl -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartControl.cs
r2139 r2289 195 195 showHiddenToolStripMenuItem.Enabled = false; 196 196 } 197 198 private void pictureBoxContextMenuStrip_Opening(object sender, CancelEventArgs e) { 199 200 } 201 202 private void toolTip_Popup(object sender, PopupEventArgs e) { 203 204 } 197 205 } 198 206 } -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartView.cs
r2135 r2289 9 9 using HeuristicLab.Core; 10 10 using HeuristicLab.CEDMA.Charting; 11 using HeuristicLab.CEDMA.Core;12 11 using HeuristicLab.PluginInfrastructure; 12 using HeuristicLab.SparseMatrix; 13 13 14 14 namespace HeuristicLab.CEDMA.Charting { 15 15 public partial class BubbleChartView : ViewBase { 16 private Results Results {17 get { return (Results)Item; }18 set { Item = value; }19 }20 16 private const string CONSTANT_SIZE = "<constant>"; 21 17 private Label pleaseSelectAxisLabel = new Label(); 22 public BubbleChartView( Resultsresults) {18 public BubbleChartView(VisualMatrix results) { 23 19 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); 34 29 sizeComboBox.Items.Add(CONSTANT_SIZE); 35 sizeComboBox.Items.AddRange( Results.OrdinalVariables);30 sizeComboBox.Items.AddRange(results.OrdinalVariables); 36 31 sizeComboBox.SelectedItem = sizeComboBox.Items[0]; 37 32 yAxisComboBox.SelectedItem = yAxisComboBox.Items[0]; … … 68 63 } 69 64 70 public IControl CreateView( Resultsresults) {65 public IControl CreateView(VisualMatrix results) { 71 66 return new BubbleChartView(results); 72 67 } -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/HeuristicLab.CEDMA.Charting-3.3.csproj
r2240 r2289 96 96 </Compile> 97 97 <Compile Include="HeuristicLabCedmaChartingPlugin.cs" /> 98 <Compile Include="IResultsViewFactory.cs" /> 99 <Compile Include="ModelingBubbleChart.cs" /> 98 100 <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" /> 99 109 </ItemGroup> 100 110 <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>105 111 <ProjectReference Include="..\..\HeuristicLab.Charting.Data\3.2\HeuristicLab.Charting.Data-3.2.csproj"> 106 112 <Project>{E0740131-AA3E-4A3F-BA03-C9FF8327F4EE}</Project> … … 119 125 <Name>HeuristicLab.PluginInfrastructure</Name> 120 126 </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> 121 131 </ItemGroup> 122 132 <ItemGroup> … … 130 140 <EmbeddedResource Include="BubbleChartView.resx"> 131 141 <DependentUpon>BubbleChartView.cs</DependentUpon> 142 </EmbeddedResource> 143 <EmbeddedResource Include="TableResultsView.resx"> 144 <DependentUpon>TableResultsView.cs</DependentUpon> 132 145 </EmbeddedResource> 133 146 </ItemGroup> -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/HeuristicLabCedmaChartingPlugin.cs
r2240 r2289 28 28 [ClassInfo(Name = "HeuristicLab.CEDMA.Charting-3.3")] 29 29 [PluginFile(Filename = "HeuristicLab.CEDMA.Charting-3.3.dll", Filetype = PluginFileType.Assembly)] 30 [Dependency(Dependency = "HeuristicLab.CEDMA.Core-3.3")]31 30 [Dependency(Dependency = "HeuristicLab.Charting-3.2")] 32 31 [Dependency(Dependency = "HeuristicLab.Charting.Data-3.2")] 33 32 [Dependency(Dependency = "HeuristicLab.Core-3.2")] 34 33 [Dependency(Dependency = "HeuristicLab.Data-3.2")] 34 [Dependency(Dependency = "HeuristicLab.SparseMatrix-3.2")] 35 35 public class HeuristicLabCedmaCorePlugin : PluginBase { 36 36 } -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/IResultsViewFactory.cs
r2279 r2289 26 26 using HeuristicLab.Core; 27 27 using System.Xml; 28 using HeuristicLab.Operators;29 28 using System.Windows.Forms; 30 29 using HeuristicLab.PluginInfrastructure; 31 30 32 namespace HeuristicLab.CEDMA.C ore{31 namespace HeuristicLab.CEDMA.Charting { 33 32 public interface IResultsViewFactory { 34 33 string Name { get; } 35 IControl CreateView( Resultsresults);34 IControl CreateView(VisualMatrix results); 36 35 } 37 36 } -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/TableResultsView.cs
r2279 r2289 10 10 using HeuristicLab.CEDMA.Core; 11 11 using HeuristicLab.PluginInfrastructure; 12 using HeuristicLab.CEDMA.Charting; 12 13 13 14 namespace HeuristicLab.CEDMA.Core { 14 15 15 16 public partial class TableResultsView : ViewBase { 16 private Results Results{17 get { return ( Results)Item; }17 private VisualMatrix VisualMatrix { 18 get { return (VisualMatrix)Item; } 18 19 set { Item = value; } 19 20 } 20 21 private bool suppressEvents; 21 public TableResultsView( Results results) {22 public TableResultsView(VisualMatrix visualMatrix) { 22 23 suppressEvents = false; 23 24 InitializeComponent(); 24 Results = results;25 results.Changed += new EventHandler(results_Changed);25 VisualMatrix = visualMatrix; 26 VisualMatrix.Changed += new EventHandler(VisualMatrixChanged); 26 27 } 27 28 28 void results_Changed(object sender, EventArgs e) {29 private void VisualMatrixChanged(object sender, EventArgs e) { 29 30 if (suppressEvents) return; 30 31 UpdateControls(); … … 35 36 dataGridView.Rows.Clear(); 36 37 dataGridView.Columns.Clear(); 37 List<string> attributeNames = Results.SelectModelAttributes().ToList(); 38 foreach (var attribute in attributeNames) { 38 foreach (var attribute in VisualMatrix.Attributes) { 39 39 dataGridView.Columns.Add(attribute, attribute); 40 40 } 41 41 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) { 45 44 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); 49 48 } 50 if ( entry.Selected) dataGridView.Rows[rowIndex].Selected = true;49 if (row.Selected) dataGridView.Rows[rowIndex].Selected = true; 51 50 } 52 51 } … … 58 57 if (suppressEvents) return; 59 58 foreach (DataGridViewRow row in dataGridView.Rows) { 60 (( ResultsEntry)row.Tag).Selected = row.Selected;59 ((VisualMatrixRow)row.Tag).Selected = row.Selected; 61 60 } 62 61 suppressEvents = true; 63 Results.FireChanged();62 VisualMatrix.FireChanged(); 64 63 suppressEvents = false; 65 64 } … … 68 67 if (e.Button == MouseButtons.Left && e.Clicks == 2) { 69 68 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; 71 70 var model = (IItem)PersistenceManager.RestoreFromGZip((byte[])entry.Get("PersistedData")); 72 71 PluginManager.ControlManager.ShowControl(model.CreateView()); … … 82 81 } 83 82 84 public IControl CreateView( Results results) {85 return new TableResultsView( results);83 public IControl CreateView(VisualMatrix matrix) { 84 return new TableResultsView(matrix); 86 85 } 87 86
Note: See TracChangeset
for help on using the changeset viewer.