- Timestamp:
- 06/23/15 13:31:49 (9 years ago)
- Location:
- branches/BubbleChart
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/BubbleChartView.Designer.cs
r12459 r12498 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea 2= new System.Windows.Forms.DataVisualization.Charting.ChartArea();49 System.Windows.Forms.DataVisualization.Charting.Series series 2= new System.Windows.Forms.DataVisualization.Charting.Series();48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 49 System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); 50 50 this.yLabel = new System.Windows.Forms.Label(); 51 51 this.xLabel = new System.Windows.Forms.Label(); … … 94 94 | System.Windows.Forms.AnchorStyles.Left) 95 95 | System.Windows.Forms.AnchorStyles.Right))); 96 chartArea 2.Name = "ChartArea1";97 this.chart.ChartAreas.Add(chartArea 2);96 chartArea1.Name = "ChartArea1"; 97 this.chart.ChartAreas.Add(chartArea1); 98 98 this.chart.Location = new System.Drawing.Point(3, 3); 99 99 this.chart.Name = "chart"; 100 series 2.ChartArea = "ChartArea1";101 series 2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;102 series 2.IsVisibleInLegend = false;103 series 2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;104 series 2.Name = "Bubbles";105 series 2.YValuesPerPoint = 2;106 this.chart.Series.Add(series 2);100 series1.ChartArea = "ChartArea1"; 101 series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; 102 series1.IsVisibleInLegend = false; 103 series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; 104 series1.Name = "Bubbles"; 105 series1.YValuesPerPoint = 2; 106 this.chart.Series.Add(series1); 107 107 this.chart.Size = new System.Drawing.Size(880, 668); 108 108 this.chart.TabIndex = 7; … … 216 216 // 217 217 this.includeChildrenCheckBox.AutoSize = true; 218 this.includeChildrenCheckBox.Checked = true; 219 this.includeChildrenCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; 218 220 this.includeChildrenCheckBox.Location = new System.Drawing.Point(94, 4); 219 221 this.includeChildrenCheckBox.Name = "includeChildrenCheckBox"; -
branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/BubbleChartView.cs
r12459 r12498 37 37 [Content(typeof(RecursiveDataItem), false)] 38 38 public partial class BubbleChartView : ItemView { 39 40 39 private enum SizeDimension { Constant = 0 } 41 40 private enum AxisDimension { Index = 0 } 42 41 43 private string xAxisValue;44 private string yAxisValue;45 private string sizeAxisValue;46 47 42 private readonly Dictionary<RecursiveDataItem, int> itemToIndexMapping = new Dictionary<RecursiveDataItem, int>(); 48 43 private readonly Dictionary<string, Dictionary<object, double>> categoricalMapping = new Dictionary<string, Dictionary<object, double>>(); 44 45 private string XAxisValue { get { return (string)xAxisComboBox.SelectedItem; } } 46 private string YAxisValue { get { return (string)yAxisComboBox.SelectedItem; } } 47 private string SizeAxisValue { get { return (string)sizeComboBox.SelectedItem; } } 49 48 50 49 public new RecursiveDataItem Content { … … 74 73 75 74 #region Tree Queries 76 77 75 private IEnumerable<RecursiveDataItem> GetAvailableItems() { 78 76 return IterateCheckedNodes() … … 117 115 int level = (int)levelNumericUpDown.Value; 118 116 bool includeChildren = includeChildrenCheckBox.Checked; 119 //treeView.BeginUpdate(); 120 foreach (var node in IterateAllNodes()) 121 node.Checked = includeChildren ? node.Level >= level : node.Level == level; 122 //treeView.EndUpdate(); 117 foreach (var node in IterateAllNodes()) { 118 bool @checked = includeChildren ? node.Level >= level : node.Level == level; 119 if (node.Checked != @checked) 120 node.Checked = @checked; 121 } 123 122 } 124 123 … … 142 141 sizeComboBox.Items.AddRange(additionalSizeDimension); 143 142 sizeComboBox.Items.AddRange(axisNames); 144 sizeComboBox.SelectedItem = SizeDimension.Constant.ToString();145 143 146 144 bool changed = false; … … 156 154 sizeComboBox.SelectedItem = selectedSizeAxis; 157 155 changed = true; 158 } 156 } else sizeComboBox.SelectedItem = SizeDimension.Constant.ToString(); 159 157 if (changed) { 160 158 UpdateDataPoints(); 161 //UpdateAxisLabels();159 UpdateAxisLabels(); 162 160 } 163 161 } … … 171 169 RebuildInverseIndex(); 172 170 173 chart.ChartAreas[0].AxisX.IsMarginVisible = xAxisValue != AxisDimension.Index.ToString();174 chart.ChartAreas[0].AxisY.IsMarginVisible = yAxisValue != AxisDimension.Index.ToString();171 chart.ChartAreas[0].AxisX.IsMarginVisible = XAxisValue != AxisDimension.Index.ToString(); 172 chart.ChartAreas[0].AxisY.IsMarginVisible = YAxisValue != AxisDimension.Index.ToString(); 175 173 176 174 if (Content != null) { 177 175 var items = GetAvailableItems(); 178 176 foreach (var item in items) { 179 var x = GetValue(item, xAxisValue);180 var y = GetValue(item, yAxisValue);181 var s = GetValue(item, sizeAxisValue);177 var x = GetValue(item, XAxisValue); 178 var y = GetValue(item, YAxisValue); 179 var s = GetValue(item, SizeAxisValue); 182 180 if (x.HasValue && y.HasValue && s.HasValue) { 183 181 var dataPoint = new DataPoint(x.Value, new[] { y.Value, s.Value }); … … 267 265 268 266 private void UpdateAxisLabels() { 269 return;270 267 Axis xAxis = chart.ChartAreas[0].AxisX; 271 268 Axis yAxis = chart.ChartAreas[0].AxisY; 272 269 //mkommend: combobox.SelectedIndex could not be used as this changes during hovering over possible values 273 var xSAxisSelected = xAxisValue == null ? null : (string)xAxisComboBox.SelectedItem;274 var ySAxisSelected = yAxisValue == null ? null : (string)yAxisComboBox.SelectedItem;270 var xSAxisSelected = XAxisValue == null ? null : (string)xAxisComboBox.SelectedItem; 271 var ySAxisSelected = YAxisValue == null ? null : (string)yAxisComboBox.SelectedItem; 275 272 SetCustomAxisLabels(xAxis, xSAxisSelected); 276 273 SetCustomAxisLabels(yAxis, ySAxisSelected); 277 if ( xAxisValue != null)278 xAxis.Title = xAxisValue;279 if ( yAxisValue != null)280 yAxis.Title = yAxisValue;274 if (XAxisValue != null) 275 xAxis.Title = XAxisValue; 276 if (YAxisValue != null) 277 yAxis.Title = YAxisValue; 281 278 } 282 279 private void chart_AxisViewChanged(object sender, System.Windows.Forms.DataVisualization.Charting.ViewEventArgs e) { … … 285 282 private void SetCustomAxisLabels(Axis axis, string key) { 286 283 axis.CustomLabels.Clear(); 287 if ( categoricalMapping.ContainsKey(key)) {284 if (key != null && categoricalMapping.ContainsKey(key)) { 288 285 foreach (var pair in categoricalMapping[key]) { 289 286 string labelText = pair.Key.ToString(); … … 298 295 axis.CustomLabels.Add(label); 299 296 } 300 } else if ( key != null && Content.Data[key] is TimeSpanValue) {297 } else if (false && key != null && Content.Data[key] is TimeSpanValue) { // TODO 301 298 chart.ChartAreas[0].RecalculateAxesScale(); 302 299 for (double i = axis.Minimum; i <= axis.Maximum; i += axis.LabelStyle.Interval) { … … 328 325 private void treeView_AfterCheck(object sender, TreeViewEventArgs e) { 329 326 UpdateComboBoxes(); 330 //UpdateDataPoints();327 UpdateDataPoints(); 331 328 } 332 329 private void treeView_AfterSelect(object sender, TreeViewEventArgs e) { … … 337 334 338 335 private void axisComboBox_SelectedValueChanged(object sender, EventArgs e) { 339 bool axisSelected = xAxisComboBox.SelectedIndex != -1 && yAxisComboBox.SelectedIndex != -1;340 341 xAxisValue = (string)xAxisComboBox.SelectedItem;342 yAxisValue = (string)yAxisComboBox.SelectedItem;343 sizeAxisValue = (string)sizeComboBox.SelectedItem;344 345 336 UpdateDataPoints(); 346 337 UpdateAxisLabels(); … … 359 350 360 351 #region Helpers 361 362 352 private IEnumerable<TreeNode> IterateAllNodes() { 363 353 return Collect(treeView.Nodes); … … 373 363 } 374 364 } 365 366 private void BeginUpdateComboBoxes() { 367 xAxisComboBox.BeginUpdate(); 368 yAxisComboBox.BeginUpdate(); 369 sizeComboBox.BeginUpdate(); 370 } 371 private void EndUpdateComboBoxes() { 372 xAxisComboBox.EndUpdate(); 373 yAxisComboBox.EndUpdate(); 374 sizeComboBox.EndUpdate(); 375 } 375 376 #endregion 376 377 } -
branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/RecursiveDataItem.cs
r12450 r12498 71 71 } 72 72 IEnumerator IEnumerable.GetEnumerator() { 73 throw new NotImplementedException();73 return data.GetEnumerator(); 74 74 } 75 75
Note: See TracChangeset
for help on using the changeset viewer.