Changeset 13836


Ignore:
Timestamp:
05/04/16 17:17:08 (4 years ago)
Author:
pfleck
Message:

#2597 Implemented correct coloring when multiple solutions are added for comparison with respect potential overlapping confidence intervals.

Location:
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChart.Designer.cs

    r13831 r13836  
    5555      legend1.Alignment = System.Drawing.StringAlignment.Center;
    5656      legend1.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
    57       legend1.LegendItemOrder = System.Windows.Forms.DataVisualization.Charting.LegendItemOrder.SameAsSeriesOrder;
     57      legend1.LegendItemOrder = System.Windows.Forms.DataVisualization.Charting.LegendItemOrder.ReversedSeriesOrder;
     58      legend1.LegendStyle = System.Windows.Forms.DataVisualization.Charting.LegendStyle.Row;
    5859      legend1.Name = "Default";
    5960      this.chart.Legends.Add(legend1);
    6061      this.chart.Location = new System.Drawing.Point(0, 0);
    6162      this.chart.Name = "chart";
    62       this.chart.PaletteCustomColors = new System.Drawing.Color[] {
    63         System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(180)))), ((int)(((byte)(65))))),
    64         System.Drawing.Color.FromArgb(((int)(((byte)(65)))), ((int)(((byte)(140)))), ((int)(((byte)(240)))))};
    6563      this.chart.Size = new System.Drawing.Size(453, 308);
    6664      this.chart.TabIndex = 0;
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChart.cs

    r13831 r13836  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Drawing;
    2425using System.Globalization;
    2526using System.Linq;
     
    2728using System.Windows.Forms.DataVisualization.Charting;
    2829using HeuristicLab.Common;
     30using HeuristicLab.MainForm.WindowsForms;
    2931using HeuristicLab.Visualization.ChartControlsExtensions;
    3032
     
    110112    public GradientChart() {
    111113      InitializeComponent();
     114
     115      // Configure axis
     116      chart.CustomizeAllChartAreas();
     117      chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
     118      chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
     119      chart.ChartAreas[0].CursorX.Interval = 0;
     120
     121      chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
     122      chart.ChartAreas[0].AxisY.ScaleView.Zoomable = true;
     123      chart.ChartAreas[0].CursorY.Interval = 0;
    112124    }
    113125
     
    187199      axis.Interval = axisInterval;
    188200
    189       // Create series
    190       chart.Series.Clear();
     201      // Create series <mean, conf. interval>
     202      var seriesDict = new Dictionary<Series, Series>();
    191203      for (int i = 0; i < solutions.Count; ++i) {
    192204        var solution = solutions[i];
    193205        Series confidenceIntervalPlotSeries;
    194         var series = CreateSeries(solution, out confidenceIntervalPlotSeries);
    195         series.Name = Solutions.First().ProblemData.TargetVariable + " " + i;
     206        var meanSeries = CreateSeries(solution, out confidenceIntervalPlotSeries);
     207        meanSeries.Name = Solutions.First().ProblemData.TargetVariable + " " + i;
     208        seriesDict.Add(meanSeries, confidenceIntervalPlotSeries);
    196209        if (confidenceIntervalPlotSeries != null)
    197           chart.Series.Add(confidenceIntervalPlotSeries);
     210          confidenceIntervalPlotSeries.Name = "95% Conf. Interval " + meanSeries.Name;
     211      }
     212
     213      chart.SuspendRepaint();
     214      chart.Series.Clear();
     215      // Add mean series for applying palette colors
     216      foreach (var series in seriesDict.Keys) {
     217        series.LegendText = series.Name;
    198218        chart.Series.Add(series);
    199219      }
     220      chart.Palette = ChartColorPalette.BrightPastel;
     221      chart.ApplyPaletteColors();
     222      chart.Palette = ChartColorPalette.None;
     223
     224      foreach (var series in seriesDict) {
     225        if (series.Value == null) continue;
     226        int idx = chart.Series.IndexOf(series.Key);
     227        series.Value.Color = Color.FromArgb(40, series.Key.Color);
     228        series.Value.IsVisibleInLegend = false;
     229        chart.Series.Insert(idx, series.Value);
     230      }
     231      chart.ResumeRepaint(true);
     232
     233
    200234      //// calculate Y-axis interval
    201235      //double ymin = 0, ymax = 0;
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/RegressionSolutionGradientView.cs

    r13831 r13836  
    3333  [View("Gradient View")]
    3434  [Content(typeof(IConfidenceBoundRegressionSolution))]
    35   public partial class RegressionSolutionGradientView
    36     : DataAnalysisSolutionEvaluationView {
    37 
     35  public partial class RegressionSolutionGradientView : DataAnalysisSolutionEvaluationView {
    3836    private const int DrawingSteps = 1000;
    39 
    40     private const string EstimatedMeanSeriesName = "Estimated Mean";
    41     private const string EstimatedVarianceSeriesName = "95% Conficence Interval";
    4237
    4338    private readonly List<string> variableNames;
Note: See TracChangeset for help on using the changeset viewer.