Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/06/16 14:50:17 (8 years ago)
Author:
bburlacu
Message:

#2594: Added chart util method to calculate the "optimal" axis interval (reducing the number of fractional digits to make it look nice). Modified the regression solution line chart and scatter plot to use the new scaling method.

File:
1 edited

Legend:

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

    r12012 r14008  
    2626using System.Windows.Forms.DataVisualization.Charting;
    2727using HeuristicLab.MainForm;
     28using HeuristicLab.Visualization.ChartControlsExtensions;
    2829
    2930namespace HeuristicLab.Problems.DataAnalysis.Views {
     
    9697        this.ToggleSeriesData(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]);
    9798
     99        // set the y-axis bounds
     100        var axisY = this.chart.ChartAreas[0].AxisY;
     101        double min = double.MaxValue, max = double.MinValue;
     102        foreach (var point in chart.Series.SelectMany(x => x.Points)) {
     103          if (!point.YValues.Any() || double.IsInfinity(point.YValues[0]) || double.IsNaN(point.YValues[0]))
     104            continue;
     105          var y = point.YValues[0];
     106          if (y < min)
     107            min = y;
     108          if (y > max)
     109            max = y;
     110        }
     111
     112        double axisMin, axisMax, axisInterval;
     113        ChartUtil.CalculateOptimalAxisInterval(min, max, out axisMin, out axisMax, out axisInterval);
     114        axisY.Minimum = axisMin;
     115        axisY.Maximum = axisMax;
     116        axisY.Interval = axisInterval;
     117
    98118        UpdateCursorInterval();
    99119        this.UpdateStripLines();
Note: See TracChangeset for help on using the changeset viewer.