Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/02/13 17:04:43 (11 years ago)
Author:
gkronber
Message:

#1508: merged r9804:9805,r9808:9809,r9811:9812,r9822,r9824:9825,r9897,r9928,r9938:9941,r9964:9965,r9989,r9991:9992,r9995,r9997,r10004:10015 from trunk into stable branch.

Location:
stable
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Trading.Views/3.4/SolutionLineChartView.cs

    r9796 r10020  
    5353      this.chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
    5454      this.chart.ChartAreas[0].AxisY.ScaleView.Zoomable = true;
     55      this.chart.ChartAreas[0].AxisY.IntervalAutoMode = IntervalAutoMode.VariableCount;
     56      this.chart.ChartAreas[0].AxisY2.ScaleView.Zoomable = false;
     57      this.chart.ChartAreas[0].AxisY2.IntervalAutoMode = IntervalAutoMode.VariableCount;
     58      this.chart.ChartAreas[0].AxisY2.LabelStyle.Enabled = false;
     59      this.chart.ChartAreas[0].AxisY2.MajorGrid.Enabled = false;
     60      this.chart.ChartAreas[0].AxisY2.MinorGrid.Enabled = false;
     61      this.chart.ChartAreas[0].AxisY2.MajorTickMark.Enabled = false;
     62      this.chart.ChartAreas[0].AxisY2.MinorTickMark.Enabled = false;
    5563      this.chart.ChartAreas[0].CursorY.Interval = 0;
    5664    }
     
    5967      this.chart.Series.Clear();
    6068      if (Content != null) {
     69        var trainingRows = Content.ProblemData.TrainingIndices;
     70        var testRows = Content.ProblemData.TestIndices;
    6171        this.chart.Series.Add(SIGNALS_SERIES_NAME);
     72        this.chart.Series[SIGNALS_SERIES_NAME].YAxisType = AxisType.Secondary;
    6273        this.chart.Series[SIGNALS_SERIES_NAME].LegendText = SIGNALS_SERIES_NAME;
    6374        this.chart.Series[SIGNALS_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    64         this.chart.Series[SIGNALS_SERIES_NAME].Points.DataBindY(Content.Signals.ToArray());
     75        this.chart.Series[SIGNALS_SERIES_NAME].Points.DataBindXY(
     76          trainingRows.Concat(testRows).ToArray(),
     77          Content.TrainingSignals.Concat(Content.TestSignals).ToArray());
    6578        this.chart.Series[SIGNALS_SERIES_NAME].Tag = Content;
    6679
    67         IEnumerable<double> accumulatedPrice = GetAccumulatedPrices(Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.PriceVariable));
     80        var trainingPriceChanges = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.PriceChangeVariable,
     81                                                                               trainingRows);
     82        var testPriceChanges = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.PriceChangeVariable,
     83                                                                               testRows);
     84        IEnumerable<double> accumulatedTrainingPrice = GetAccumulatedProfits(trainingPriceChanges);
     85        IEnumerable<double> accumulatedTestPrice = GetAccumulatedProfits(testPriceChanges);
    6886        this.chart.Series.Add(PRICEVARIABLE_SERIES_NAME);
     87        this.chart.Series[PRICEVARIABLE_SERIES_NAME].YAxisType = AxisType.Primary;
    6988        this.chart.Series[PRICEVARIABLE_SERIES_NAME].LegendText = PRICEVARIABLE_SERIES_NAME;
    7089        this.chart.Series[PRICEVARIABLE_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    71         this.chart.Series[PRICEVARIABLE_SERIES_NAME].Points.DataBindY(accumulatedPrice.ToArray());
     90        this.chart.Series[PRICEVARIABLE_SERIES_NAME].Points.DataBindXY(
     91          trainingRows.Concat(testRows).ToArray(),
     92          accumulatedTrainingPrice.Concat(accumulatedTestPrice).ToArray());
    7293        this.chart.Series[PRICEVARIABLE_SERIES_NAME].Tag = Content;
    7394
    74         IEnumerable<double> profit = OnlineProfitCalculator.GetProfits(Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.PriceVariable), Content.Signals, Content.ProblemData.TransactionCosts);
    75         IEnumerable<double> accumulatedProfits = GetAccumulatedPrices(profit);
     95
     96        IEnumerable<double> trainingProfit = OnlineProfitCalculator.GetProfits(trainingPriceChanges, Content.TrainingSignals, Content.ProblemData.TransactionCosts);
     97        IEnumerable<double> testProfit = OnlineProfitCalculator.GetProfits(testPriceChanges, Content.TestSignals, Content.ProblemData.TransactionCosts);
     98        IEnumerable<double> accTrainingProfit = GetAccumulatedProfits(trainingProfit);
     99        IEnumerable<double> accTestProfit = GetAccumulatedProfits(testProfit);
    76100        this.chart.Series.Add(ASSET_SERIES_NAME);
     101        this.chart.Series[ASSET_SERIES_NAME].YAxisType = AxisType.Primary;
    77102        this.chart.Series[ASSET_SERIES_NAME].LegendText = ASSET_SERIES_NAME;
    78103        this.chart.Series[ASSET_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    79         this.chart.Series[ASSET_SERIES_NAME].Points.DataBindY(accumulatedProfits.ToArray());
     104        this.chart.Series[ASSET_SERIES_NAME].Points.DataBindXY(
     105          trainingRows.Concat(testRows).ToArray(),
     106          accTrainingProfit.Concat(accTestProfit).ToArray());
    80107        this.chart.Series[ASSET_SERIES_NAME].Tag = Content;
    81108
     
    84111    }
    85112
    86     private IEnumerable<double> GetAccumulatedPrices(IEnumerable<double> xs) {
     113    private IEnumerable<double> GetAccumulatedProfits(IEnumerable<double> xs) {
    87114      double sum = 0;
    88115      foreach (var x in xs) {
Note: See TracChangeset for help on using the changeset viewer.