Ignore:
Timestamp:
09/20/13 13:08:31 (6 years ago)
Author:
gkronber
Message:

#1508 fixed bugs in line chart visualization for the trading plugin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Trading.Views/3.4/SolutionLineChartView.cs

    r9992 r9997  
    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;
    5556      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;
    5663      this.chart.ChartAreas[0].CursorY.Interval = 0;
    5764    }
     
    6370        var testRows = Content.ProblemData.TestIndices;
    6471        this.chart.Series.Add(SIGNALS_SERIES_NAME);
     72        this.chart.Series[SIGNALS_SERIES_NAME].YAxisType = AxisType.Secondary;
    6573        this.chart.Series[SIGNALS_SERIES_NAME].LegendText = SIGNALS_SERIES_NAME;
    6674        this.chart.Series[SIGNALS_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    67         this.chart.Series[SIGNALS_SERIES_NAME].Points.DataBindY(Content.TrainingSignals.Concat(Content.TestSignals).ToArray());
     75        this.chart.Series[SIGNALS_SERIES_NAME].Points.DataBindXY(
     76          trainingRows.Concat(testRows).ToArray(),
     77          Content.TrainingSignals.Concat(Content.TestSignals).ToArray());
    6878        this.chart.Series[SIGNALS_SERIES_NAME].Tag = Content;
    69         this.chart.Series[SIGNALS_SERIES_NAME].YAxisType = AxisType.Secondary;
    7079
    71         IEnumerable<double> accumulatedPrice = GetAccumulatedProfits(Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.PriceChangeVariable));
     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);
    7286        this.chart.Series.Add(PRICEVARIABLE_SERIES_NAME);
     87        this.chart.Series[PRICEVARIABLE_SERIES_NAME].YAxisType = AxisType.Primary;
    7388        this.chart.Series[PRICEVARIABLE_SERIES_NAME].LegendText = PRICEVARIABLE_SERIES_NAME;
    7489        this.chart.Series[PRICEVARIABLE_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    75         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());
    7693        this.chart.Series[PRICEVARIABLE_SERIES_NAME].Tag = Content;
    77         this.chart.Series[SIGNALS_SERIES_NAME].YAxisType = AxisType.Primary;
    7894
    7995
    80         IEnumerable<double> trainingProfit = OnlineProfitCalculator.GetProfits(Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.PriceChangeVariable, trainingRows), Content.TrainingSignals, Content.ProblemData.TransactionCosts);
    81         IEnumerable<double> testProfit = OnlineProfitCalculator.GetProfits(Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.PriceChangeVariable, testRows), Content.TestSignals, Content.ProblemData.TransactionCosts);
     96        IEnumerable<double> trainingProfit = OnlineProfitCalculator.GetProfits(trainingPriceChanges, Content.TrainingSignals, Content.ProblemData.TransactionCosts);
     97        IEnumerable<double> testProfit = OnlineProfitCalculator.GetProfits(testPriceChanges, Content.TestSignals, Content.ProblemData.TransactionCosts);
    8298        IEnumerable<double> accTrainingProfit = GetAccumulatedProfits(trainingProfit);
    8399        IEnumerable<double> accTestProfit = GetAccumulatedProfits(testProfit);
    84100        this.chart.Series.Add(ASSET_SERIES_NAME);
     101        this.chart.Series[ASSET_SERIES_NAME].YAxisType = AxisType.Primary;
    85102        this.chart.Series[ASSET_SERIES_NAME].LegendText = ASSET_SERIES_NAME;
    86103        this.chart.Series[ASSET_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    87         this.chart.Series[ASSET_SERIES_NAME].Points.DataBindY(accTrainingProfit.Concat(accTestProfit).ToArray());
     104        this.chart.Series[ASSET_SERIES_NAME].Points.DataBindXY(
     105          trainingRows.Concat(testRows).ToArray(),
     106          accTrainingProfit.Concat(accTestProfit).ToArray());
    88107        this.chart.Series[ASSET_SERIES_NAME].Tag = Content;
    89         this.chart.Series[SIGNALS_SERIES_NAME].YAxisType = AxisType.Primary;
    90108
    91109        this.UpdateStripLines();
Note: See TracChangeset for help on using the changeset viewer.