Changeset 4845 for trunk/sources
- Timestamp:
- 11/19/10 10:44:04 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs
r4812 r4845 232 232 double? sizeValue; 233 233 Series series = this.chart.Series[0]; 234 int row = this.Content.ToList().IndexOf(run); 235 236 if (!xAxisComboBox.DroppedDown) 237 this.xAxisValue = (string)xAxisComboBox.SelectedItem; 238 if (!yAxisComboBox.DroppedDown) 239 this.yAxisValue = (string)yAxisComboBox.SelectedItem; 240 if (!sizeComboBox.DroppedDown) 241 this.sizeAxisValue = (string)sizeComboBox.SelectedItem; 242 243 xValue = GetValue(run, this.xAxisValue); 244 yValue = GetValue(run, this.yAxisValue); 245 sizeValue = GetValue(run, this.sizeAxisValue); 234 235 xValue = GetValue(run, xAxisValue); 236 yValue = GetValue(run, yAxisValue); 237 sizeValue = GetValue(run, sizeAxisValue); 246 238 247 239 if (xValue.HasValue && yValue.HasValue && sizeValue.HasValue) { … … 508 500 xTrackBar.Enabled = yTrackBar.Enabled = axisSelected; 509 501 colorXAxisButton.Enabled = colorYAxisButton.Enabled = axisSelected; 502 503 if (!xAxisComboBox.DroppedDown) 504 xAxisValue = (string)xAxisComboBox.SelectedItem; 505 if (!yAxisComboBox.DroppedDown) 506 yAxisValue = (string)yAxisComboBox.SelectedItem; 507 if (!sizeComboBox.DroppedDown) 508 sizeAxisValue = (string)sizeComboBox.SelectedItem; 509 510 510 UpdateDataPoints(); 511 511 UpdateAxisLabels(); … … 584 584 #region automatic coloring 585 585 private void colorXAxisButton_Click(object sender, EventArgs e) { 586 double minValue = chart.Series[0].Points.Min(p => p.XValue); 587 double maxValue = chart.Series[0].Points.Max(p => p.XValue); 588 foreach (DataPoint point in chart.Series[0].Points) { 589 int colorIndex = (int)((ColorGradient.Colors.Count - 1) * (point.XValue - minValue) / (maxValue - minValue)); 590 IRun run = point.Tag as IRun; 591 if (run != null) run.Color = ColorGradient.Colors[colorIndex]; 592 } 586 ColorRuns(xAxisValue); 593 587 } 594 588 595 589 private void colorYAxisButton_Click(object sender, EventArgs e) { 596 double minValue = chart.Series[0].Points.Min(p => p.YValues[0]); 597 double maxValue = chart.Series[0].Points.Max(p => p.YValues[0]); 598 foreach (DataPoint point in chart.Series[0].Points) { 599 int colorIndex = (int)((ColorGradient.Colors.Count - 1) * (point.YValues[0] - minValue) / (maxValue - minValue)); 600 IRun run = point.Tag as IRun; 601 if (run != null) run.Color = ColorGradient.Colors[colorIndex]; 590 ColorRuns(yAxisValue); 591 } 592 593 private void ColorRuns(string axisValue) { 594 var runs = Content.Select(r => new { Run = r, Value = GetValue(r, axisValue) }).Where(r => r.Value.HasValue); 595 double minValue = runs.Min(r => r.Value.Value); 596 double maxValue = runs.Max(r => r.Value.Value); 597 double range = maxValue - minValue; 598 599 foreach (var r in runs) { 600 int colorIndex = 0; 601 if (!range.IsAlmost(0)) colorIndex = (int)((ColorGradient.Colors.Count - 1) * (r.Value.Value - minValue) / (maxValue - minValue)); 602 r.Run.Color = ColorGradient.Colors[colorIndex]; 602 603 } 603 604 }
Note: See TracChangeset
for help on using the changeset viewer.