Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8835


Ignore:
Timestamp:
10/23/12 10:38:43 (12 years ago)
Author:
mkommend
Message:

#1918: Refactored jittering in BubbleChartView to calculate axis range before the data points are modified and removed 'strange' method.

File:
1 edited

Legend:

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

    r8832 r8835  
    259259        }
    260260      }
    261       var xAxis = chart.ChartAreas[0].AxisX;
    262       var yAxis = chart.ChartAreas[0].AxisY;
    263261      xTrackBar.Value = 0;
    264262      yTrackBar.Value = 0;
     
    290288      var yAxis = this.chart.ChartAreas[0].AxisY;
    291289
    292 
    293       // disable automatic update of axis
    294       var disabledParameters = new AxisParameters();
    295       disabledParameters.min = disabledParameters.max = disabledParameters.majorGridInterval = disabledParameters.majorTickMarkInterval = disabledParameters.labelStyleInterval = double.NaN;
    296 
    297       AxisParameters savedXParameters, savedYParameters;
    298       savedXParameters = SetAxisParameters(xAxis, disabledParameters);
    299       savedYParameters = SetAxisParameters(yAxis, disabledParameters);
     290      double xAxisRange = xAxis.Maximum - xAxis.Minimum;
     291      double yAxisRange = yAxis.Maximum - yAxis.Minimum;
    300292
    301293      foreach (DataPoint point in chart.Series[0].Points) {
     
    305297
    306298        if (!xJitterFactor.IsAlmost(0.0))
    307           xValue += 0.1 * GetXJitter(run) * xJitterFactor * (savedXParameters.max - savedXParameters.min);
     299          xValue += 0.1 * GetXJitter(run) * xJitterFactor * (xAxisRange);
    308300        if (!yJitterFactor.IsAlmost(0.0))
    309           yValue += 0.1 * GetYJitter(run) * yJitterFactor * (savedYParameters.max - savedYParameters.min);
     301          yValue += 0.1 * GetYJitter(run) * yJitterFactor * (yAxisRange);
    310302
    311303        point.XValue = xValue;
    312304        point.YValues[0] = yValue;
    313305      }
    314       SetAxisParameters(xAxis, savedXParameters);
    315       SetAxisParameters(yAxis, savedYParameters);
    316     }
    317 
    318     private AxisParameters SetAxisParameters(Axis axis, AxisParameters @new) {
    319       var old = new AxisParameters();
    320       old.min = axis.Minimum;
    321       old.max = axis.Maximum;
    322       old.majorGridInterval = axis.MajorGrid.Interval;
    323       old.majorTickMarkInterval = axis.MajorTickMark.Interval;
    324       old.labelStyleInterval = axis.LabelStyle.Interval;
    325 
    326       axis.Maximum = @new.max;
    327       axis.Minimum = @new.min;
    328       axis.MajorGrid.Interval = @new.majorGridInterval;
    329       axis.MajorTickMark.Interval = @new.majorTickMarkInterval;
    330       axis.LabelStyle.Interval = @new.labelStyleInterval;
    331       return old;
     306
    332307    }
    333308
Note: See TracChangeset for help on using the changeset viewer.