Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/07/10 16:38:19 (14 years ago)
Author:
gkronber
Message:

Added adjustment of cursor interval based on range of displayed values in the RunCollectionBubbleChartView ScatterPlotView and LineChartView. #893

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/LineChartView.cs

    r3566 r3707  
    5555      this.chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
    5656      this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
    57       this.chart.ChartAreas[0].CursorX.Interval = 0;
     57      this.chart.ChartAreas[0].CursorX.Interval = 1;
    5858
    5959      this.chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
     
    7575      this.chart.Series[ESTIMATEDVALUES_SERIES_NAME].Points.DataBindY(Content.EstimatedValues.ToArray());
    7676      this.chart.Series[ESTIMATEDVALUES_SERIES_NAME].Tag = Content;
     77      UpdateCursorInterval();
     78    }
     79
     80    private void UpdateCursorInterval() {
     81      var estimatedValues = this.chart.Series[ESTIMATEDVALUES_SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0);
     82      var targetValues = this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0);
     83      double estimatedValuesRange = estimatedValues.Max() - estimatedValues.Min();
     84      double targetValuesRange = targetValues.Max() - targetValues.Min();
     85      double interestingValuesRange = Math.Min(Math.Max(targetValuesRange, 1.0), Math.Max(estimatedValuesRange, 1.0));
     86      double digits = (int)Math.Log10(interestingValuesRange) - 3;
     87      double yZoomInterval = Math.Max(Math.Pow(10, digits), 10E-5);
     88      this.chart.ChartAreas[0].CursorY.Interval = yZoomInterval;
    7789    }
    7890
     
    112124            s.LegendText = Content.ItemName;
    113125            this.UpdateStripLines();
     126            UpdateCursorInterval();
    114127          }
    115128        }
Note: See TracChangeset for help on using the changeset viewer.