Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8485


Ignore:
Timestamp:
08/14/12 13:27:53 (12 years ago)
Author:
gkronber
Message:

#1890 fixed a bug in the regression solution line chart that leads to an exception when the chart is shown which is however lost in the message queue. The bug has the effect that the empty point manipulation does not work correctly for instance in solutions produced through cross-validation

File:
1 edited

Legend:

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

    r8139 r8485  
    8989        this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].LegendText = ESTIMATEDVALUES_ALL_SERIES_NAME;
    9090        this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    91         this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndices, allEstimatedValues);
    92         this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]);
     91        if (allEstimatedValues.Count > 0) {
     92          this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndices, allEstimatedValues);
     93          this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]);
     94        }
    9395        this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Tag = Content;
    9496        this.ToggleSeriesData(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]);
     
    224226
    225227        IEnumerable<int> indices = null;
    226         IEnumerable<double> predictedValues = null;
     228        double[] predictedValues = null;
    227229        switch (series.Name) {
    228230          case ESTIMATEDVALUES_ALL_SERIES_NAME:
    229231            indices = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndices).Except(Content.ProblemData.TestIndices).ToArray();
    230232            var estimatedValues = Content.EstimatedValues.ToArray();
    231             predictedValues = indices.Select(index => estimatedValues[index]).ToList();
     233            predictedValues = indices.Select(index => estimatedValues[index]).ToArray();
    232234            break;
    233235          case ESTIMATEDVALUES_TRAINING_SERIES_NAME:
     
    240242            break;
    241243        }
    242         series.Points.DataBindXY(indices, predictedValues);
    243         this.InsertEmptyPoints(series);
     244        if (predictedValues.Length > 0) {
     245          series.Points.DataBindXY(indices, predictedValues);
     246          this.InsertEmptyPoints(series);
     247        }
    244248        chart.Legends[series.Legend].ForeColor = Color.Black;
    245249        UpdateCursorInterval();
Note: See TracChangeset for help on using the changeset viewer.