Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/16/11 12:00:36 (13 years ago)
Author:
mkommend
Message:

#1479: Integrated trunk changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs

    r6647 r6784  
    130130        if (this.chart.Series[ALL_SERIES].Points.Count > 0)
    131131          this.chart.Series[ALL_SERIES].Points.DataBindXY(Content.EstimatedValues.ToArray(), "",
    132             dataset.GetVariableValues(targetVariableName), "");
     132            dataset.GetDoubleValues(targetVariableName).ToArray(), "");
    133133        if (this.chart.Series[TRAINING_SERIES].Points.Count > 0)
    134134          this.chart.Series[TRAINING_SERIES].Points.DataBindXY(Content.EstimatedTrainingValues.ToArray(), "",
    135             dataset.GetEnumeratedVariableValues(targetVariableName, Content.ProblemData.TrainingIndizes).ToArray(), "");
     135            dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndizes).ToArray(), "");
    136136        if (this.chart.Series[TEST_SERIES].Points.Count > 0)
    137137          this.chart.Series[TEST_SERIES].Points.DataBindXY(Content.EstimatedTestValues.ToArray(), "",
    138            dataset.GetEnumeratedVariableValues(targetVariableName, Content.ProblemData.TestIndizes).ToArray(), "");
    139 
    140         double max = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetVariableValues(targetVariableName)))).Max();
    141         double min = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetVariableValues(targetVariableName)))).Min();
     138           dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndizes).ToArray(), "");
     139
     140        double max = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetDoubleValues(targetVariableName)))).Max();
     141        double min = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetDoubleValues(targetVariableName)))).Min();
    142142
    143143        max = max + 0.2 * Math.Abs(max);
     
    177177          case ALL_SERIES:
    178178            predictedValues = Content.EstimatedValues.ToArray();
    179             targetValues = Content.ProblemData.Dataset.GetVariableValues(targetVariableName);
     179            targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName).ToArray();
    180180            break;
    181181          case TRAINING_SERIES:
    182182            predictedValues = Content.EstimatedTrainingValues.ToArray();
    183             targetValues = Content.ProblemData.Dataset.GetEnumeratedVariableValues(targetVariableName, Content.ProblemData.TrainingIndizes).ToArray();
     183            targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndizes).ToArray();
    184184            break;
    185185          case TEST_SERIES:
    186186            predictedValues = Content.EstimatedTestValues.ToArray();
    187             targetValues = Content.ProblemData.Dataset.GetEnumeratedVariableValues(targetVariableName, Content.ProblemData.TestIndizes).ToArray();
     187            targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndizes).ToArray();
    188188            break;
    189189        }
     
    219219      e.LegendItems[2].Cells[1].ForeColor = this.chart.Series[TEST_SERIES].Points.Count == 0 ? Color.Gray : Color.Black;
    220220    }
     221
     222    private void chart_PostPaint(object sender, ChartPaintEventArgs e) {
     223      var chartArea = e.ChartElement as ChartArea;
     224      if (chartArea != null) {
     225        ChartGraphics chartGraphics = e.ChartGraphics;
     226        using (Pen p = new Pen(Color.DarkGray)) {
     227          double xmin = chartArea.AxisX.ScaleView.ViewMinimum;
     228          double xmax = chartArea.AxisX.ScaleView.ViewMaximum;
     229          double ymin = chartArea.AxisY.ScaleView.ViewMinimum;
     230          double ymax = chartArea.AxisY.ScaleView.ViewMaximum;
     231
     232          if (xmin > ymax || ymin > xmax) return;
     233
     234          PointF start = PointF.Empty;
     235          start.X = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisX.AxisName, Math.Max(xmin, ymin));
     236          start.Y = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisY.AxisName, Math.Max(xmin, ymin));
     237          PointF end = PointF.Empty;
     238          end.X = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisX.AxisName, Math.Min(xmax, ymax));
     239          end.Y = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisY.AxisName, Math.Min(xmax, ymax));
     240
     241          chartGraphics.Graphics.DrawLine(p, chartGraphics.GetAbsolutePoint(start), chartGraphics.GetAbsolutePoint(end));
     242        }
     243      }
     244    }
    221245  }
    222246}
Note: See TracChangeset for help on using the changeset viewer.