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/ScatterPlotView.cs

    r3566 r3707  
    7272      this.chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
    7373      this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
    74       this.chart.ChartAreas[0].CursorX.Interval = 0;
    75       this.chart.ChartAreas[0].CursorY.Interval = 0;
     74      this.chart.ChartAreas[0].CursorX.Interval = 1;
     75      this.chart.ChartAreas[0].CursorY.Interval = 1;
    7676
    7777      this.chart.ChartAreas[0].AxisY.Title = "Target Values";
     
    120120      }
    121121    }
     122
     123    private void UpdateCursorInterval() {
     124      var estimatedValues = this.chart.Series[ALL_SERIES].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0);
     125      var targetValues = this.chart.Series[ALL_SERIES].Points.Select(x => x.YValues[1]).DefaultIfEmpty(1.0);
     126      double estimatedValuesRange = estimatedValues.Max() - estimatedValues.Min();
     127      double targetValuesRange = targetValues.Max() - targetValues.Min();
     128      double interestingValuesRange = Math.Min(Math.Max(targetValuesRange, 1.0), Math.Max(estimatedValuesRange, 1.0));
     129      double digits = (int)Math.Log10(interestingValuesRange) - 3;
     130      double zoomInterval = Math.Max(Math.Pow(10, digits), 10E-5);
     131      this.chart.ChartAreas[0].CursorX.Interval = zoomInterval;
     132      this.chart.ChartAreas[0].CursorY.Interval = zoomInterval;
     133    }
     134
    122135
    123136    private void UpdateSeries() {
     
    150163        this.chart.ChartAreas[0].AxisY.Maximum = max;
    151164        this.chart.ChartAreas[0].AxisY.Minimum = min;
     165        UpdateCursorInterval();
    152166      }
    153167    }
     
    156170      this.chart.Series[ALL_SERIES].Points.Clear();
    157171      this.chart.Series[TRAINING_SERIES].Points.Clear();
    158       this.chart.Series[TEST_SERIES].Points.Clear();
     172      this.chart.Series[TEST_SERIES].Points.Clear();     
    159173    }
    160174
     
    190204        series.Points.DataBindXY(predictedValues, "", targetValues, "");
    191205        this.chart.Legends[series.Legend].ForeColor = Color.Black;
     206        UpdateCursorInterval();
    192207      }
    193208    }
Note: See TracChangeset for help on using the changeset viewer.