Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2359 for trunk


Ignore:
Timestamp:
09/15/09 16:02:26 (15 years ago)
Author:
mkommend
Message:

changed behavior of bubblechart in ZoomToViewSize method (ticket #723)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChart.cs

    r2325 r2359  
    137137        } else if (matrix.MultiDimensionalCategoricalVariables.Contains(xDimension)) {
    138138          var path = xDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
    139           IEnumerable<MatrixRow<string, object>> subRows = (IEnumerable<MatrixRow<string,object>>)r.Get(path.ElementAt(0));
     139          IEnumerable<MatrixRow<string, object>> subRows = (IEnumerable<MatrixRow<string, object>>)r.Get(path.ElementAt(0));
    140140          foreach (MatrixRow<string, object> subRow in subRows) {
    141141            if (subRow.Get(path.ElementAt(1)) != null) {
     
    147147          var path = xDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
    148148          IEnumerable<MatrixRow<string, object>> subRows = (IEnumerable<MatrixRow<string, object>>)r.Get(path.ElementAt(0));
    149           foreach (MatrixRow<string,object> subRow in subRows) {
     149          foreach (MatrixRow<string, object> subRow in subRows) {
    150150            if (subRow.Get(path.ElementAt(1)) != null) {
    151151              xs.Add(Convert.ToDouble(subRow.Get(path.ElementAt(1))) + r.XJitter * xJitterFactor);
     
    162162        } else if (matrix.MultiDimensionalCategoricalVariables.Contains(yDimension)) {
    163163          var path = yDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
    164           IEnumerable<MatrixRow<string,object>> subRows = (IEnumerable<MatrixRow<string,object>>)r.Get(path.ElementAt(0));
    165           foreach (MatrixRow<string,object> subRow in subRows) {
     164          IEnumerable<MatrixRow<string, object>> subRows = (IEnumerable<MatrixRow<string, object>>)r.Get(path.ElementAt(0));
     165          foreach (MatrixRow<string, object> subRow in subRows) {
    166166            if (subRow.Get(path.ElementAt(1)) != null) {
    167167              ys.Add(matrix.IndexOfCategoricalValue(yDimension, subRow.Get(path.ElementAt(1))) + r.YJitter * yJitterFactor);
     
    172172          var path = yDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
    173173          IEnumerable<MatrixRow<string, object>> subRows = (IEnumerable<MatrixRow<string, object>>)r.Get(path.ElementAt(0));
    174           foreach (MatrixRow<string,object> subRow in subRows) {
     174          foreach (MatrixRow<string, object> subRow in subRows) {
    175175            if (subRow.Get(path.ElementAt(1)) != null) {
    176176              ys.Add(Convert.ToDouble(subRow.Get(path.ElementAt(1))) + r.YJitter * yJitterFactor);
     
    195195          if (double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN;
    196196          if (double.IsInfinity(y) || y == double.MaxValue || y == double.MinValue) y = double.NaN;
    197           if (!double.IsNaN(x) && !double.IsNaN(y) && IsReasonablePoint(new PointD(x, y))) {
     197          //if (!double.IsNaN(x) && !double.IsNaN(y) && IsReasonablePoint(new PointD(x, y))) {
     198            if (!double.IsNaN(x) && !double.IsNaN(y)) {
    198199            string actualXValue = actualXValues[Math.Min(i, actualXValues.Count() - 1)].ToString();
    199200            string actualYValue = actualYValues[Math.Min(i, actualYValues.Count() - 1)].ToString();
     
    216217    }
    217218
    218     private bool IsReasonablePoint(PointD pointD) {
    219       return pointD.X > LowerLeft.X && pointD.X < UpperRight.X && pointD.Y > LowerLeft.Y && pointD.Y < UpperRight.Y;
    220     }
     219    //Mk 15.09.09 15:00 commented because it is not necessary any more and causes troubles with repainting
     220    //private bool IsReasonablePoint(PointD pointD) {
     221    //  return pointD.X > LowerLeft.X && pointD.X < UpperRight.X && pointD.Y > LowerLeft.Y && pointD.Y < UpperRight.Y;
     222    //}
    221223
    222224    private int CalculateSize(double size, double minSize, double maxSize) {
     
    235237
    236238    private void ZoomToViewSize() {
    237       if (minX < maxX && minY < maxY) {
    238         // enlarge view by 5% on each side
    239         double width = maxX - minX;
    240         double height = maxY - minY;
    241         minX = minX - width * 0.05;
    242         maxX = maxX + width * 0.05;
    243         minY = minY - height * 0.05;
    244         maxY = maxY + height * 0.05;
    245         ZoomIn(minX, minY, maxX, maxY);
    246       }
     239      // enlarge view by 5% on each side
     240      //if (minX < maxX && minY < maxY) {
     241      //  double width = maxX - minX;
     242      //  minX = minX - width * 0.05;
     243      //  maxX = maxX + width * 0.05;
     244      //}
     245
     246      //if(minY < maxY)
     247      //{
     248      //  double height = maxY - minY;
     249      //  minY = minY - height * 0.05;
     250      //  maxY = maxY + height * 0.05;
     251      //}
     252      if (double.IsInfinity(minX) || double.IsNaN(minX) ||
     253        double.IsInfinity(maxX) || double.IsNaN(maxX) ||
     254        double.IsInfinity(minY) || double.IsNaN(minY) ||
     255        double.IsInfinity(maxY) || double.IsNaN(maxY))
     256        return;
     257
     258      double height = maxY - minY;
     259      double width = maxX - minX;
     260      if (height < 10)
     261        height = 10;
     262      if (width < 10)
     263        width = 10;
     264
     265      minY = minY - height * 0.05;
     266      maxY = maxY + height * 0.05;
     267      minX = minX - width * 0.05;
     268      maxX = maxX + width * 0.05;
     269      ZoomIn(minX, minY, maxX, maxY);
    247270    }
    248271
Note: See TracChangeset for help on using the changeset viewer.