Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/05/16 22:43:11 (8 years ago)
Author:
bburlacu
Message:

#2597: Fixed a couple of bugs in the GradientChart related to the configuration of axis limits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChart.cs

    r13995 r14006  
    8282        if ((value.HasValue && fixedXAxisMin.HasValue && !value.Value.IsAlmost(fixedXAxisMin.Value)) || (value.HasValue != fixedXAxisMin.HasValue)) {
    8383          fixedXAxisMin = value;
    84           SetupAxis(chart.ChartAreas[0].AxisX, trainingMin, trainingMax, XAxisTicks, FixedXAxisMin, FixedXAxisMax);
    85           RecalculateInternalDataset();
     84          if (trainingMin < trainingMax) {
     85            SetupAxis(chart.ChartAreas[0].AxisX, trainingMin, trainingMax, XAxisTicks, FixedXAxisMin, FixedXAxisMax);
     86            RecalculateInternalDataset();
     87            // set the vertical line position
     88            if (VerticalLineAnnotation.X <= fixedXAxisMin) {
     89              var axisX = chart.ChartAreas[0].AxisX;
     90              var step = (axisX.Maximum - axisX.Minimum) / drawingSteps;
     91              VerticalLineAnnotation.X = axisX.Minimum + step;
     92            }
     93          }
    8694        }
    8795      }
     
    93101        if ((value.HasValue && fixedXAxisMax.HasValue && !value.Value.IsAlmost(fixedXAxisMax.Value)) || (value.HasValue != fixedXAxisMax.HasValue)) {
    94102          fixedXAxisMax = value;
    95           SetupAxis(chart.ChartAreas[0].AxisX, trainingMin, trainingMax, XAxisTicks, FixedXAxisMin, FixedXAxisMax);
    96           RecalculateInternalDataset();
     103          if (trainingMin < trainingMax) {
     104            SetupAxis(chart.ChartAreas[0].AxisX, trainingMin, trainingMax, XAxisTicks, FixedXAxisMin, FixedXAxisMax);
     105            RecalculateInternalDataset();
     106            // set the vertical line position
     107            if (VerticalLineAnnotation.X >= fixedXAxisMax) {
     108              var axisX = chart.ChartAreas[0].AxisX;
     109              var step = (axisX.Maximum - axisX.Minimum) / drawingSteps;
     110              VerticalLineAnnotation.X = axisX.Maximum - step;
     111            }
     112          }
    97113        }
    98114      }
     
    267283      var minimum = chart.ChartAreas[0].AxisX.Minimum;
    268284      var maximum = chart.ChartAreas[0].AxisX.Maximum;
    269       if (defaultValue.IsAlmost(minimum))
     285      if (defaultValue <= minimum)
    270286        VerticalLineAnnotation.X = minimum + step;
    271       else if (defaultValue.IsAlmost(maximum))
     287      else if (defaultValue >= maximum)
    272288        VerticalLineAnnotation.X = maximum - step;
    273289      else
     
    536552
    537553      lowerStripLine.IntervalOffset = axisX.Minimum;
    538       lowerStripLine.StripWidth = trainingMin - axisX.Minimum;
     554      lowerStripLine.StripWidth = Math.Abs(trainingMin - axisX.Minimum);
    539555
    540556      upperStripLine.IntervalOffset = trainingMax;
    541       upperStripLine.StripWidth = axisX.Maximum - trainingMax;
     557      upperStripLine.StripWidth = Math.Abs(axisX.Maximum - trainingMax);
    542558    }
    543559
Note: See TracChangeset for help on using the changeset viewer.