Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5976


Ignore:
Timestamp:
04/07/11 14:06:18 (14 years ago)
Author:
mkommend
Message:

#1413: Corrected bugs regarding automatic coloring and axis value changes in RunCollectionBubbleChart. Additionally removed feature to drag runs because it was useless.

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.Designer.cs

    r5824 r5976  
    204204      this.chart.Text = "chart";
    205205      this.chart.AxisViewChanged += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.ViewEventArgs>(this.chart_AxisViewChanged);
    206       this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown);
     206      this.chart.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.chart_DoubleClick);
    207207      this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove);
    208208      this.chart.MouseUp += new System.Windows.Forms.MouseEventHandler(this.chart_MouseUp);
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r5837 r5976  
    432432
    433433    #region Drag & drop and tooltip
    434     private IRun draggedRun;
    435     private void chart_MouseDown(object sender, MouseEventArgs e) {
     434    private void chart_DoubleClick(object sender, MouseEventArgs e) {
    436435      HitTestResult h = this.chart.HitTest(e.X, e.Y);
    437436      if (h.ChartElementType == ChartElementType.DataPoint) {
    438437        IRun run = (IRun)((DataPoint)h.Object).Tag;
    439         if (e.Clicks >= 2) {
    440           IContentView view = MainFormManager.MainForm.ShowContent(run);
    441           if (view != null) {
    442             view.ReadOnly = this.ReadOnly;
    443             view.Locked = this.Locked;
    444           }
    445         } else
    446           this.draggedRun = run;
     438        IContentView view = MainFormManager.MainForm.ShowContent(run);
     439        if (view != null) {
     440          view.ReadOnly = this.ReadOnly;
     441          view.Locked = this.Locked;
     442        }
    447443        this.chart.ChartAreas[0].CursorX.SetSelectionPosition(double.NaN, double.NaN);
    448444        this.chart.ChartAreas[0].CursorY.SetSelectionPosition(double.NaN, double.NaN);
     
    452448    private void chart_MouseUp(object sender, MouseEventArgs e) {
    453449      if (isSelecting) {
    454         Content.UpdateOfRunsInProgress = true;
    455450        System.Windows.Forms.DataVisualization.Charting.Cursor xCursor = chart.ChartAreas[0].CursorX;
    456451        System.Windows.Forms.DataVisualization.Charting.Cursor yCursor = chart.ChartAreas[0].CursorY;
     
    484479        this.chart.ChartAreas[0].CursorX.SelectionStart = this.chart.ChartAreas[0].CursorX.SelectionEnd;
    485480        this.chart.ChartAreas[0].CursorY.SelectionStart = this.chart.ChartAreas[0].CursorY.SelectionEnd;
    486         Content.UpdateOfRunsInProgress = false;
    487481      }
    488482    }
     
    490484    private void chart_MouseMove(object sender, MouseEventArgs e) {
    491485      HitTestResult h = this.chart.HitTest(e.X, e.Y);
    492       if (!Locked) {
    493         if (this.draggedRun != null && h.ChartElementType != ChartElementType.DataPoint) {
    494           DataObject data = new DataObject();
    495           data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, draggedRun);
    496           if (ReadOnly)
    497             DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    498           else {
    499             DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
    500             if ((result & DragDropEffects.Move) == DragDropEffects.Move)
    501               Content.Remove(draggedRun);
    502           }
    503           this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = !isSelecting;
    504           this.chart.ChartAreas[0].AxisY.ScaleView.Zoomable = !isSelecting;
    505           this.draggedRun = null;
    506         }
    507       }
    508 
    509486      string newTooltipText = string.Empty;
    510487      string oldTooltipText;
     
    670647
    671648    private void ColorRuns(string axisValue) {
    672       Content.UpdateOfRunsInProgress = true;
    673649      var runs = Content.Select(r => new { Run = r, Value = GetValue(r, axisValue) }).Where(r => r.Value.HasValue);
    674650      double minValue = runs.Min(r => r.Value.Value);
     
    678654      foreach (var r in runs) {
    679655        int colorIndex = 0;
    680         if (!range.IsAlmost(0)) colorIndex = (int)((ColorGradient.Colors.Count - 1) * (r.Value.Value - minValue) / (maxValue - minValue));
     656        if (!range.IsAlmost(0)) colorIndex = (int)((ColorGradient.Colors.Count - 1) * (r.Value.Value - minValue) / (range));
    681657        r.Run.Color = ColorGradient.Colors[colorIndex];
    682658      }
    683       Content.UpdateOfRunsInProgress = false;
    684659    }
    685660    #endregion
Note: See TracChangeset for help on using the changeset viewer.