Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/13/08 13:36:57 (16 years ago)
Author:
gkronber
Message:
  • asynchronous downloading of agents and results from the CEDMA server
  • created a chart that displays points as bubbles (scatter-plot + optional third dimension for the size of the bubble, larger bubbles are more transparent than smaller bubbles)

ticket #268 (Possibility to open the function-tree of any model (represented as point in the scatter-plot))

Location:
trunk/sources/HeuristicLab.CEDMA.Charting
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Charting/HeuristicLab.CEDMA.Charting.csproj

    r560 r561  
    5050  </ItemGroup>
    5151  <ItemGroup>
     52    <Compile Include="BubbleChart.cs" />
     53    <Compile Include="BubbleChartControl.cs">
     54      <SubType>UserControl</SubType>
     55    </Compile>
     56    <Compile Include="BubbleChartControl.Designer.cs">
     57      <DependentUpon>BubbleChartControl.cs</DependentUpon>
     58    </Compile>
    5259    <Compile Include="HeuristicLabCedmaChartingPlugin.cs" />
    5360    <Compile Include="Histogram.cs" />
     
    6572      <Project>{4F9BB789-D561-436B-B226-2BF44B7D0804}</Project>
    6673      <Name>HeuristicLab.CEDMA.DB.Interfaces</Name>
    67     </ProjectReference>
    68     <ProjectReference Include="..\HeuristicLab.Charting.Data\HeuristicLab.Charting.Data.csproj">
    69       <Project>{E0740131-AA3E-4A3F-BA03-C9FF8327F4EE}</Project>
    70       <Name>HeuristicLab.Charting.Data</Name>
    7174    </ProjectReference>
    7275    <ProjectReference Include="..\HeuristicLab.Charting\HeuristicLab.Charting.csproj">
     
    8891  </ItemGroup>
    8992  <ItemGroup>
     93    <EmbeddedResource Include="BubbleChartControl.resx">
     94      <DependentUpon>BubbleChartControl.cs</DependentUpon>
     95      <SubType>Designer</SubType>
     96    </EmbeddedResource>
    9097    <EmbeddedResource Include="ResultListView.resx">
    9198      <DependentUpon>ResultListView.cs</DependentUpon>
  • trunk/sources/HeuristicLab.CEDMA.Charting/HeuristicLabCedmaChartingPlugin.cs

    r560 r561  
    2929  [PluginFile(Filename = "HeuristicLab.CEDMA.Charting.dll", Filetype = PluginFileType.Assembly)]
    3030  [Dependency(Dependency = "HeuristicLab.Charting")]
    31   [Dependency(Dependency = "HeuristicLab.Charting.Data")]
    3231  [Dependency(Dependency = "HeuristicLab.Core")]
    3332  [Dependency(Dependency = "HeuristicLab.CEDMA.DB.Interfaces")]
  • trunk/sources/HeuristicLab.CEDMA.Charting/ResultList.cs

    r560 r561  
    6161      set {
    6262        store = value;
    63         ReloadList();
    64         FireChanged();
     63        Action reloadList = ReloadList;
     64        reloadList.BeginInvoke(null, null);
    6565      }
    6666    }
     67
    6768    private List<string> variableNames = new List<string>() { TARGET_VARIABLE, TREE_SIZE, TREE_HEIGHT,
    6869    MAPE_TRAINING, MAPE_VALIDATION, MAPE_TEST,
     
    7677
    7778    private void ReloadList() {
    78       allVariables.Clear();
    7979      List<double> trainingMAPE = new List<double>();
    8080      List<double> validationMAPE = new List<double>();
     
    8686      List<double> height = new List<double>();
    8787      List<double> targetVariable = new List<double>();
    88       allVariables[MAPE_TRAINING] = trainingMAPE;
    89       allVariables[MAPE_VALIDATION] = validationMAPE;
    90       allVariables[MAPE_TEST] = testMAPE;
    91       allVariables[R2_TRAINING] = trainingR2;
    92       allVariables[R2_VALIDATION] = validationR2;
    93       allVariables[R2_TEST] = testR2;
    94       allVariables[TREE_SIZE] = size;
    95       allVariables[TREE_HEIGHT] = height;
    96       allVariables[TARGET_VARIABLE] = targetVariable;
     88
     89      lock(allVariables) {
     90        allVariables.Clear();
     91        allVariables[MAPE_TRAINING] = trainingMAPE;
     92        allVariables[MAPE_VALIDATION] = validationMAPE;
     93        allVariables[MAPE_TEST] = testMAPE;
     94        allVariables[R2_TRAINING] = trainingR2;
     95        allVariables[R2_VALIDATION] = validationR2;
     96        allVariables[R2_TEST] = testR2;
     97        allVariables[TREE_SIZE] = size;
     98        allVariables[TREE_HEIGHT] = height;
     99        allVariables[TARGET_VARIABLE] = targetVariable;
     100      }
    97101
    98102      var results = store.Select(new Statement(anyEntity, new Entity(cedmaNS + "instanceOf"), new Literal("class:GpFunctionTree")))
     
    106110      Random random = new Random(); // for adding random noise to int values
    107111      foreach(Statement[] ss in results) {
    108         targetVariable.Add(double.NaN);
    109         size.Add(double.NaN);
    110         height.Add(double.NaN);
    111         trainingMAPE.Add(double.NaN);
    112         validationMAPE.Add(double.NaN);
    113         testMAPE.Add(double.NaN);
    114         trainingR2.Add(double.NaN);
    115         validationR2.Add(double.NaN);
    116         testR2.Add(double.NaN);
    117         foreach(Statement s in ss) {
    118           if(s.Predicate.Equals(targetVariablePredicate)) {
    119             ReplaceLastItem(targetVariable, (double)(int)((Literal)s.Property).Value);
    120           } else if(s.Predicate.Equals(treeSizePredicate)) {
    121             ReplaceLastItem(size, (double)(int)((Literal)s.Property).Value);
    122           } else if(s.Predicate.Equals(treeHeightPredicate)) {
    123             ReplaceLastItem(height, (double)(int)((Literal)s.Property).Value);
    124           } else if(s.Predicate.Equals(trainingMAPEPredicate)) {
    125             ReplaceLastItem(trainingMAPE, (double)((Literal)s.Property).Value);
    126           } else if(s.Predicate.Equals(validationMAPEPredicate)) {
    127             ReplaceLastItem(validationMAPE, (double)((Literal)s.Property).Value);
    128           } else if(s.Predicate.Equals(testMAPEPredicate)) {
    129             ReplaceLastItem(testMAPE, (double)((Literal)s.Property).Value);
    130           } else if(s.Predicate.Equals(trainingR2Predicate)) {
    131             ReplaceLastItem(trainingR2, (double)((Literal)s.Property).Value);
    132           } else if(s.Predicate.Equals(validationR2Predicate)) {
    133             ReplaceLastItem(validationR2, (double)((Literal)s.Property).Value);
    134           } else if(s.Predicate.Equals(testR2Predicate)) {
    135             ReplaceLastItem(testR2, (double)((Literal)s.Property).Value);
     112        lock(allVariables) {
     113          targetVariable.Add(double.NaN);
     114          size.Add(double.NaN);
     115          height.Add(double.NaN);
     116          trainingMAPE.Add(double.NaN);
     117          validationMAPE.Add(double.NaN);
     118          testMAPE.Add(double.NaN);
     119          trainingR2.Add(double.NaN);
     120          validationR2.Add(double.NaN);
     121          testR2.Add(double.NaN);
     122          foreach(Statement s in ss) {
     123            if(s.Predicate.Equals(targetVariablePredicate)) {
     124              ReplaceLastItem(targetVariable, (double)(int)((Literal)s.Property).Value);
     125            } else if(s.Predicate.Equals(treeSizePredicate)) {
     126              ReplaceLastItem(size, (double)(int)((Literal)s.Property).Value);
     127            } else if(s.Predicate.Equals(treeHeightPredicate)) {
     128              ReplaceLastItem(height, (double)(int)((Literal)s.Property).Value);
     129            } else if(s.Predicate.Equals(trainingMAPEPredicate)) {
     130              ReplaceLastItem(trainingMAPE, (double)((Literal)s.Property).Value);
     131            } else if(s.Predicate.Equals(validationMAPEPredicate)) {
     132              ReplaceLastItem(validationMAPE, (double)((Literal)s.Property).Value);
     133            } else if(s.Predicate.Equals(testMAPEPredicate)) {
     134              ReplaceLastItem(testMAPE, (double)((Literal)s.Property).Value);
     135            } else if(s.Predicate.Equals(trainingR2Predicate)) {
     136              ReplaceLastItem(trainingR2, (double)((Literal)s.Property).Value);
     137            } else if(s.Predicate.Equals(validationR2Predicate)) {
     138              ReplaceLastItem(validationR2, (double)((Literal)s.Property).Value);
     139            } else if(s.Predicate.Equals(testR2Predicate)) {
     140              ReplaceLastItem(testR2, (double)((Literal)s.Property).Value);
     141            }
    136142          }
    137143        }
     144        FireChanged();
    138145      }
    139146    }
     
    154161    internal Histogram GetHistogram(string variableName) {
    155162      Histogram h = new Histogram(50);
    156       h.AddValues(allVariables[variableName]);
     163      lock(allVariables) {
     164        h.AddValues(allVariables[variableName]);
     165      }
    157166      return h;
    158167    }
    159168
    160169    internal IList<double> GetValues(string variableName) {
    161       return allVariables[variableName];
     170      List<double> result = new List<double>();
     171      lock(allVariables) {
     172        result.AddRange(allVariables[variableName]);
     173      }
     174      return result;
    162175    }
    163176  }
  • trunk/sources/HeuristicLab.CEDMA.Charting/ResultListView.Designer.cs

    r560 r561  
    2424    /// </summary>
    2525    private void InitializeComponent() {
    26       this.dataChart = new HeuristicLab.Charting.Data.DataChartControl();
     26      this.yJitterLabel = new System.Windows.Forms.Label();
     27      this.xJitterlabel = new System.Windows.Forms.Label();
     28      this.xTrackBar = new System.Windows.Forms.TrackBar();
    2729      this.xAxisLabel = new System.Windows.Forms.Label();
    2830      this.xAxisComboBox = new System.Windows.Forms.ComboBox();
     
    3032      this.yAxisComboBox = new System.Windows.Forms.ComboBox();
    3133      this.yTrackBar = new System.Windows.Forms.TrackBar();
    32       this.xTrackBar = new System.Windows.Forms.TrackBar();
    33       this.xJitterlabel = new System.Windows.Forms.Label();
    34       this.yJitterLabel = new System.Windows.Forms.Label();
     34      this.dataChart = new HeuristicLab.CEDMA.Charting.BubbleChartControl();
     35      this.sizeComboBox = new System.Windows.Forms.ComboBox();
     36      this.sizeLabel = new System.Windows.Forms.Label();
     37      this.invertCheckbox = new System.Windows.Forms.CheckBox();
     38      ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit();
    3539      ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit();
    36       ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit();
    3740      this.SuspendLayout();
    3841      //
    39       // dataChart
    40       //
    41       this.dataChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    42                   | System.Windows.Forms.AnchorStyles.Left)
    43                   | System.Windows.Forms.AnchorStyles.Right)));
    44       this.dataChart.BackColor = System.Drawing.SystemColors.Control;
    45       this.dataChart.Chart = null;
    46       this.dataChart.Location = new System.Drawing.Point(3, 30);
    47       this.dataChart.Name = "dataChart";
    48       this.dataChart.ScaleOnResize = true;
    49       this.dataChart.Size = new System.Drawing.Size(447, 390);
    50       this.dataChart.TabIndex = 9;
     42      // yJitterLabel
     43      //
     44      this.yJitterLabel.AutoSize = true;
     45      this.yJitterLabel.Location = new System.Drawing.Point(3, 30);
     46      this.yJitterLabel.Name = "yJitterLabel";
     47      this.yJitterLabel.Size = new System.Drawing.Size(29, 13);
     48      this.yJitterLabel.TabIndex = 13;
     49      this.yJitterLabel.Text = "jitter:";
     50      //
     51      // xJitterlabel
     52      //
     53      this.xJitterlabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     54      this.xJitterlabel.AutoSize = true;
     55      this.xJitterlabel.Location = new System.Drawing.Point(291, 418);
     56      this.xJitterlabel.Name = "xJitterlabel";
     57      this.xJitterlabel.Size = new System.Drawing.Size(29, 13);
     58      this.xJitterlabel.TabIndex = 12;
     59      this.xJitterlabel.Text = "jitter:";
     60      //
     61      // xTrackBar
     62      //
     63      this.xTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     64      this.xTrackBar.Location = new System.Drawing.Point(326, 418);
     65      this.xTrackBar.Maximum = 100;
     66      this.xTrackBar.Name = "xTrackBar";
     67      this.xTrackBar.Size = new System.Drawing.Size(121, 45);
     68      this.xTrackBar.TabIndex = 11;
     69      this.xTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
     70      this.xTrackBar.ValueChanged += new System.EventHandler(this.jitterTrackBar_ValueChanged);
    5171      //
    5272      // xAxisLabel
     
    5474      this.xAxisLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    5575      this.xAxisLabel.AutoSize = true;
    56       this.xAxisLabel.Location = new System.Drawing.Point(197, 429);
     76      this.xAxisLabel.Location = new System.Drawing.Point(305, 394);
    5777      this.xAxisLabel.Name = "xAxisLabel";
    5878      this.xAxisLabel.Size = new System.Drawing.Size(15, 13);
     
    6484      this.xAxisComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    6585      this.xAxisComboBox.FormattingEnabled = true;
    66       this.xAxisComboBox.Location = new System.Drawing.Point(218, 426);
     86      this.xAxisComboBox.Location = new System.Drawing.Point(326, 391);
    6787      this.xAxisComboBox.Name = "xAxisComboBox";
    6888      this.xAxisComboBox.Size = new System.Drawing.Size(121, 21);
     
    90110      // yTrackBar
    91111      //
    92       this.yTrackBar.Location = new System.Drawing.Point(186, 3);
     112      this.yTrackBar.Location = new System.Drawing.Point(38, 30);
    93113      this.yTrackBar.Maximum = 100;
    94114      this.yTrackBar.Name = "yTrackBar";
    95       this.yTrackBar.Size = new System.Drawing.Size(60, 45);
     115      this.yTrackBar.Size = new System.Drawing.Size(107, 45);
    96116      this.yTrackBar.TabIndex = 10;
    97117      this.yTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
    98       this.yTrackBar.ValueChanged += new System.EventHandler(this.yTrackBar_ValueChanged);
    99       //
    100       // xTrackBar
    101       //
    102       this.xTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    103       this.xTrackBar.Location = new System.Drawing.Point(387, 426);
    104       this.xTrackBar.Maximum = 100;
    105       this.xTrackBar.Name = "xTrackBar";
    106       this.xTrackBar.Size = new System.Drawing.Size(60, 45);
    107       this.xTrackBar.TabIndex = 11;
    108       this.xTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
    109       this.xTrackBar.ValueChanged += new System.EventHandler(this.xTrackBar_ValueChanged);
    110       //
    111       // xJitterlabel
    112       //
    113       this.xJitterlabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    114       this.xJitterlabel.AutoSize = true;
    115       this.xJitterlabel.Location = new System.Drawing.Point(352, 429);
    116       this.xJitterlabel.Name = "xJitterlabel";
    117       this.xJitterlabel.Size = new System.Drawing.Size(29, 13);
    118       this.xJitterlabel.TabIndex = 12;
    119       this.xJitterlabel.Text = "jitter:";
    120       //
    121       // yJitterLabel
    122       //
    123       this.yJitterLabel.AutoSize = true;
    124       this.yJitterLabel.Location = new System.Drawing.Point(151, 6);
    125       this.yJitterLabel.Name = "yJitterLabel";
    126       this.yJitterLabel.Size = new System.Drawing.Size(29, 13);
    127       this.yJitterLabel.TabIndex = 13;
    128       this.yJitterLabel.Text = "jitter:";
     118      this.yTrackBar.ValueChanged += new System.EventHandler(this.jitterTrackBar_ValueChanged);
     119      //
     120      // dataChart
     121      //
     122      this.dataChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     123                  | System.Windows.Forms.AnchorStyles.Left)
     124                  | System.Windows.Forms.AnchorStyles.Right)));
     125      this.dataChart.BackColor = System.Drawing.SystemColors.Control;
     126      this.dataChart.Chart = null;
     127      this.dataChart.Location = new System.Drawing.Point(3, 81);
     128      this.dataChart.Name = "dataChart";
     129      this.dataChart.ScaleOnResize = true;
     130      this.dataChart.Size = new System.Drawing.Size(447, 304);
     131      this.dataChart.TabIndex = 9;
     132      //
     133      // sizeComboBox
     134      //
     135      this.sizeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     136      this.sizeComboBox.FormattingEnabled = true;
     137      this.sizeComboBox.Location = new System.Drawing.Point(329, 3);
     138      this.sizeComboBox.Name = "sizeComboBox";
     139      this.sizeComboBox.Size = new System.Drawing.Size(121, 21);
     140      this.sizeComboBox.TabIndex = 14;
     141      this.sizeComboBox.SelectedIndexChanged += new System.EventHandler(this.sizeComboBox_SelectedIndexChanged);
     142      //
     143      // sizeLabel
     144      //
     145      this.sizeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     146      this.sizeLabel.AutoSize = true;
     147      this.sizeLabel.Location = new System.Drawing.Point(259, 6);
     148      this.sizeLabel.Name = "sizeLabel";
     149      this.sizeLabel.Size = new System.Drawing.Size(64, 13);
     150      this.sizeLabel.TabIndex = 15;
     151      this.sizeLabel.Text = "Bubble size:";
     152      //
     153      // invertCheckbox
     154      //
     155      this.invertCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     156      this.invertCheckbox.AutoSize = true;
     157      this.invertCheckbox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
     158      this.invertCheckbox.Location = new System.Drawing.Point(326, 30);
     159      this.invertCheckbox.Name = "invertCheckbox";
     160      this.invertCheckbox.Size = new System.Drawing.Size(64, 17);
     161      this.invertCheckbox.TabIndex = 16;
     162      this.invertCheckbox.Text = "Inverse:";
     163      this.invertCheckbox.UseVisualStyleBackColor = true;
     164      this.invertCheckbox.CheckedChanged += new System.EventHandler(this.sizeComboBox_SelectedIndexChanged);
    129165      //
    130166      // ResultListView
     
    132168      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    133169      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     170      this.Controls.Add(this.invertCheckbox);
     171      this.Controls.Add(this.sizeLabel);
     172      this.Controls.Add(this.sizeComboBox);
     173      this.Controls.Add(this.dataChart);
    134174      this.Controls.Add(this.yJitterLabel);
    135175      this.Controls.Add(this.xJitterlabel);
    136176      this.Controls.Add(this.xTrackBar);
    137       this.Controls.Add(this.dataChart);
    138177      this.Controls.Add(this.xAxisLabel);
    139178      this.Controls.Add(this.xAxisComboBox);
     
    142181      this.Controls.Add(this.yTrackBar);
    143182      this.Name = "ResultListView";
    144       this.Size = new System.Drawing.Size(450, 450);
     183      this.Size = new System.Drawing.Size(450, 459);
     184      ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).EndInit();
    145185      ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).EndInit();
    146       ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).EndInit();
    147186      this.ResumeLayout(false);
    148187      this.PerformLayout();
     
    152191    #endregion
    153192
    154     private HeuristicLab.Charting.Data.DataChartControl dataChart;
     193    private BubbleChartControl dataChart;
    155194    private System.Windows.Forms.Label xAxisLabel;
    156195    private System.Windows.Forms.ComboBox xAxisComboBox;
     
    161200    private System.Windows.Forms.Label xJitterlabel;
    162201    private System.Windows.Forms.Label yJitterLabel;
     202    private System.Windows.Forms.ComboBox sizeComboBox;
     203    private System.Windows.Forms.Label sizeLabel;
     204    private System.Windows.Forms.CheckBox invertCheckbox;
    163205  }
    164206}
  • trunk/sources/HeuristicLab.CEDMA.Charting/ResultListView.cs

    r560 r561  
    1414    private ResultList results;
    1515    private const string FREQUENCY = "<Frequency>";
     16    private const string CONSTANT_SIZE = "<constant>";
    1617    private double xJitterFactor = 0.0;
    1718    private double yJitterFactor = 0.0;
     
    2122    public ResultListView(ResultList results) {
    2223      this.results = results;
     24      results.Changed += new EventHandler(results_Changed);
    2325      InitializeComponent();
    24       dataChart.Chart = new HeuristicLab.Charting.Data.Datachart(0, 0, 100, 1);
    2526      xAxisComboBox.Items.AddRange(results.VariableNames);
    2627      yAxisComboBox.Items.Add(FREQUENCY);
    2728      yAxisComboBox.Items.AddRange(results.VariableNames);
     29      sizeComboBox.Items.Add(CONSTANT_SIZE);
     30      sizeComboBox.Items.AddRange(results.VariableNames);
     31      sizeComboBox.SelectedItem = sizeComboBox.Items[0];
     32      InitChart();
     33    }
     34
     35    private DateTime lastUpdate = DateTime.Now;
     36    void results_Changed(object sender, EventArgs e) {
     37      if(DateTime.Now.Subtract(lastUpdate).TotalSeconds < 3) return;
     38      lastUpdate = DateTime.Now;
     39      InitChart();
     40    }
     41
     42    private void InitChart() {
     43      dataChart.Chart = new BubbleChart(0, 0, 100, 100);
     44      foreach(string dim in results.VariableNames) {
     45        dataChart.Chart.AddDimension(dim);
     46        IList<double> xs = results.GetValues(dim);
     47        for(int i = 0; i < xs.Count; i++) {
     48          double x = xs[i];
     49          if(double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN;
     50          if(!double.IsNaN(x)) {
     51            dataChart.Chart.AddDataPoint(dim, x);
     52          }
     53        }
     54      }
    2855    }
    2956
     
    4572        CreateHistogramChart();
    4673      } else {
    47         CreateScatterplot();
     74        dataChart.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem);
    4875      }
    4976    }
    5077
    51     private void CreateScatterplot() {
    52       double minX = double.PositiveInfinity;
    53       double minY = double.PositiveInfinity;
    54       double maxX = double.NegativeInfinity;
    55       double maxY = double.NegativeInfinity;
    56 
    57       xTrackBar.Enabled = true;
    58       yTrackBar.Enabled = true;
    59       Random random = new Random();
    60       Color curCol = Color.FromArgb(30, Color.Blue);
    61       Pen p = new Pen(curCol);
    62       SolidBrush b = new SolidBrush(curCol);
    63       IList<double> xs = results.GetValues((string)xAxisComboBox.SelectedItem);
    64       IList<double> ys = results.GetValues((string)yAxisComboBox.SelectedItem);
    65       dataChart.Chart = new HeuristicLab.Charting.Data.Datachart(0, 0, 100, 100);
    66       dataChart.Chart.UpdateEnabled = false;
    67       dataChart.Chart.Group.Add(new Axis(dataChart.Chart, 0, 0, AxisType.Both));
    68       dataChart.Chart.AddDataRow(HeuristicLab.Charting.Data.DataRowType.Points, p, b);
    69       for(int i = 0; i < xs.Count; i++) {
    70         double x = xs[i] + (random.NextDouble() * 2.0 - 1.0) * xJitterFactor;
    71         double y = ys[i] + (random.NextDouble() * 2.0 - 1.0) * yJitterFactor;
    72         if(double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN;
    73         if(double.IsInfinity(y) || y == double.MaxValue || y == double.MinValue) y = double.NaN;
    74         if(!double.IsNaN(x) && !double.IsNaN(y)) {
    75           dataChart.Chart.AddDataPoint(0, x, y);
    76           if(x > maxX) maxX = x;
    77           if(y > maxY) maxY = y;
    78           if(x < minX) minX = x;
    79           if(y < minY) minY = y;
    80         }
    81       }
    82       dataChart.Chart.UpdateEnabled = true;
    83       if(minX<maxX && minY<maxY) dataChart.Chart.ZoomIn(minX, minY, maxX, maxY);
     78    private void CreateHistogramChart() {
     79      // TASK
    8480    }
    85 
    86     private void CreateHistogramChart() {
    87       double minX = double.PositiveInfinity;
    88       double minY = double.PositiveInfinity;
    89       double maxX = double.NegativeInfinity;
    90       double maxY = double.NegativeInfinity;
    91 
    92       xTrackBar.Enabled = false;
    93       yTrackBar.Enabled = false;
    94       Color curCol = Color.Blue;
    95       Pen p = new Pen(curCol);
    96       SolidBrush b = new SolidBrush(curCol);
    97       // frequency
    98       dataChart.Chart = new HeuristicLab.Charting.Data.Datachart(0, 0, 100, 100);
    99       dataChart.Chart.UpdateEnabled = false;
    100       dataChart.Chart.Group.Add(new Axis(dataChart.Chart, 0, 0, AxisType.Both));
    101       Histogram h = results.GetHistogram((string)xAxisComboBox.SelectedItem);
    102       for(int i = 0; i < h.Buckets; i++) {
    103         double lower = h.LowerValue(i);
    104         double upper = h.UpperValue(i);
    105         int freq = h.Frequency(i);
    106         if(lower < minX) minX = lower;
    107         if(upper > maxX) maxX = upper;
    108         if(freq > maxY) maxY = freq;
    109         dataChart.Chart.AddDataRow(HeuristicLab.Charting.Data.DataRowType.Bars, p, b);
    110         dataChart.Chart.AddDataPoint(0, lower, 0);
    111         dataChart.Chart.AddDataPoint(0, upper, freq);
    112       }
    113       minY = 0;
    114       dataChart.Chart.UpdateEnabled = true;
    115       if(minX < maxX && minY < maxY) dataChart.Chart.ZoomIn(minX, minY, maxX, maxY);
    116     }
    117 
    118     private void yTrackBar_ValueChanged(object sender, EventArgs e) {
     81   
     82    private void jitterTrackBar_ValueChanged(object sender, EventArgs e) {
    11983      if(dataChart.Chart != null) {
    120         yJitterFactor = yTrackBar.Value / 100.0 * maxYJitterPercent * dataChart.Chart.Size.Height;
     84        double xJitterFactor = xTrackBar.Value / 100.0 ;
     85        double yJitterFactor = yTrackBar.Value / 100.0 ;
     86        dataChart.Chart.SetJitter(xJitterFactor, yJitterFactor);
    12187      }
    12288      UpdateChart();
    12389    }
    12490
    125     private void xTrackBar_ValueChanged(object sender, EventArgs e) {
     91    private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
    12692      if(dataChart.Chart != null) {
    127         xJitterFactor = xTrackBar.Value / 100.0 * maxXJitterPercent * dataChart.Chart.Size.Width;
     93        dataChart.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked);
     94        UpdateChart();
    12895      }
    129       UpdateChart();
    13096    }
    13197  }
Note: See TracChangeset for help on using the changeset viewer.