Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13764


Ignore:
Timestamp:
04/14/16 16:51:25 (8 years ago)
Author:
bburlacu
Message:

#2594: Add ChartUtil methods and improved scaling in RegressionSolutionScatterPlotView.

Location:
trunk/sources
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs

    r12509 r13764  
    2626using HeuristicLab.MainForm;
    2727using HeuristicLab.MainForm.WindowsForms;
     28using HeuristicLab.Visualization.ChartControlsExtensions;
    2829
    2930namespace HeuristicLab.Problems.DataAnalysis.Views {
     
    156157        double min = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetDoubleValues(targetVariableName)))).Min();
    157158
    158         max = max + 0.2 * Math.Abs(max);
    159         min = min - 0.2 * Math.Abs(min);
    160 
    161         double interestingValuesRange = max - min;
    162         int digits = Math.Max(0, 3 - (int)Math.Log10(interestingValuesRange));
    163 
    164         max = Math.Round(max, digits);
    165         min = Math.Round(min, digits);
    166 
    167         this.chart.ChartAreas[0].AxisX.Maximum = max;
    168         this.chart.ChartAreas[0].AxisX.Minimum = min;
    169         this.chart.ChartAreas[0].AxisY.Maximum = max;
    170         this.chart.ChartAreas[0].AxisY.Minimum = min;
     159        double axisMin, axisMax, axisInterval;
     160        ChartUtil.CalculateAxisInterval(min, max, 5, out axisMin, out axisMax, out axisInterval);
     161        this.chart.ChartAreas[0].AxisX.Maximum = axisMax;
     162        this.chart.ChartAreas[0].AxisX.Minimum = axisMin;
     163        this.chart.ChartAreas[0].AxisX.Interval = axisInterval;
     164        this.chart.ChartAreas[0].AxisY.Maximum = axisMax;
     165        this.chart.ChartAreas[0].AxisY.Minimum = axisMin;
     166        this.chart.ChartAreas[0].AxisY.Interval = axisInterval;
     167
    171168        UpdateCursorInterval();
    172169      }
Note: See TracChangeset for help on using the changeset viewer.