Changeset 5824


Ignore:
Timestamp:
03/24/11 15:46:59 (11 years ago)
Author:
mkommend
Message:

#1413: Corrected jitter in RunCollectionBubbleChartView and adapted default bubble size.

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

    r5445 r5824  
    315315      this.sizeTrackBar.TabIndex = 24;
    316316      this.sizeTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
    317       this.sizeTrackBar.Value = 15;
     317      this.sizeTrackBar.Value = 10;
    318318      this.sizeTrackBar.ValueChanged += new System.EventHandler(this.sizeTrackBar_ValueChanged);
    319319      //
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r5744 r5824  
    239239        }
    240240      }
     241      var xAxis = chart.ChartAreas[0].AxisX;
     242      var yAxis = chart.ChartAreas[0].AxisY;
     243      xTrackBar.Value = 0;
     244      yTrackBar.Value = 0;
     245      SetAutomaticUpdateOfAxis(xAxis, true);
     246      SetAutomaticUpdateOfAxis(yAxis, true);
    241247    }
    242248
     
    256262        point.MarkerSize = (int)Math.Round((sizeTrackBar.Value - sizeTrackBar.Minimum) * relativeSize + sizeTrackBar.Minimum);
    257263      }
     264    }
     265
     266    private void UpdateDataPointJitter() {
     267      var xAxis = this.chart.ChartAreas[0].AxisX;
     268      var yAxis = this.chart.ChartAreas[0].AxisY;
     269      SetAutomaticUpdateOfAxis(xAxis, false);
     270      SetAutomaticUpdateOfAxis(yAxis, false);
     271
     272      foreach (DataPoint point in chart.Series[0].Points) {
     273        IRun run = (IRun)point.Tag;
     274        double xValue = GetValue(run, xAxisValue).Value;
     275        double yValue = GetValue(run, yAxisValue).Value;
     276
     277        if (!xJitterFactor.IsAlmost(0.0))
     278          xValue += 0.1 * GetXJitter(run) * xJitterFactor * (xAxis.Maximum - xAxis.Minimum);
     279        if (!yJitterFactor.IsAlmost(0.0))
     280          yValue += 0.1 * GetYJitter(run) * yJitterFactor * (yAxis.Maximum - yAxis.Minimum);
     281
     282        point.XValue = xValue;
     283        point.YValues[0] = yValue;
     284      }
     285    }
     286
     287    private void SetAutomaticUpdateOfAxis(Axis axis, bool enabled) {
     288      if (enabled) {
     289        axis.Maximum = double.NaN;
     290        axis.Minimum = double.NaN;
     291        axis.MajorGrid.Interval = double.NaN;
     292        axis.MajorTickMark.Interval = double.NaN;
     293        axis.LabelStyle.Interval = double.NaN;
     294      } else {
     295        axis.Minimum = axis.Minimum;
     296        axis.Maximum = axis.Maximum;
     297        axis.MajorGrid.Interval = axis.MajorGrid.Interval;
     298        axis.MajorTickMark.Interval = axis.MajorTickMark.Interval;
     299        axis.LabelStyle.Interval = axis.LabelStyle.Interval;
     300      }
     301
    258302    }
    259303
     
    270314      if (xValue.HasValue && yValue.HasValue && sizeValue.HasValue) {
    271315        xValue = xValue.Value;
    272         if (!xJitterFactor.IsAlmost(0.0))
    273           xValue += 0.1 * GetXJitter(run) * xJitterFactor * (this.chart.ChartAreas[0].AxisX.Maximum - this.chart.ChartAreas[0].AxisX.Minimum);
     316
    274317        yValue = yValue.Value;
    275         if (!yJitterFactor.IsAlmost(0.0))
    276           yValue += 0.1 * GetYJitter(run) * yJitterFactor * (this.chart.ChartAreas[0].AxisY.Maximum - this.chart.ChartAreas[0].AxisY.Minimum);
     318
    277319        if (run.Visible) {
    278320          DataPoint point = new DataPoint(xValue.Value, new double[] { yValue.Value, sizeValue.Value });
     
    280322          point.Color = run.Color;
    281323          series.Points.Add(point);
    282 
    283324          if (!runToDataPointMapping.ContainsKey(run)) runToDataPointMapping.Add(run, new List<DataPoint>());
    284325          runToDataPointMapping[run].Add(point);
     
    527568      this.xJitterFactor = xTrackBar.Value / 100.0;
    528569      this.yJitterFactor = yTrackBar.Value / 100.0;
    529       this.UpdateDataPoints();
     570      UpdateDataPointJitter();
    530571    }
    531572    private void sizeTrackBar_ValueChanged(object sender, EventArgs e) {
     
    643684    }
    644685    #endregion
     686
    645687  }
    646688}
Note: See TracChangeset for help on using the changeset viewer.