Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/19/13 12:36:17 (11 years ago)
Author:
mkommend
Message:

#1789: Implemented inverting of the bubble size in the RunCollectionBubbleChartView.

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.Designer.cs

    r9190 r9229  
    318318      this.sizeTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    319319      this.sizeTrackBar.Location = new System.Drawing.Point(787, 3);
    320       this.sizeTrackBar.Maximum = 50;
    321       this.sizeTrackBar.Minimum = 5;
     320      this.sizeTrackBar.Maximum = 20;
     321      this.sizeTrackBar.Minimum = -20;
    322322      this.sizeTrackBar.Name = "sizeTrackBar";
    323323      this.sizeTrackBar.Size = new System.Drawing.Size(64, 45);
    324324      this.sizeTrackBar.TabIndex = 24;
    325       this.sizeTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
    326       this.sizeTrackBar.Value = 10;
     325      this.sizeTrackBar.TickFrequency = 25;
     326      this.sizeTrackBar.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
    327327      this.sizeTrackBar.ValueChanged += new System.EventHandler(this.sizeTrackBar_ValueChanged);
    328328      //
    329       // ToolStripMenuItem
     329      // getDataAsMatrixToolStripMenuItem
    330330      //
    331331      this.getDataAsMatrixToolStripMenuItem.Name = "getDataAsMatrixToolStripMenuItem";
     
    336336      // RunCollectionBubbleChartView
    337337      //
    338       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    339338      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    340339      this.BackColor = System.Drawing.SystemColors.Window;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs

    r9190 r9229  
    2020#endregion
    2121
    22 using HeuristicLab.Common;
    23 using HeuristicLab.Core;
    24 using HeuristicLab.Data;
    25 using HeuristicLab.MainForm;
    26 using HeuristicLab.MainForm.WindowsForms;
    2722using System;
    2823using System.Collections.Generic;
     
    3126using System.Windows.Forms;
    3227using System.Windows.Forms.DataVisualization.Charting;
     28using HeuristicLab.Common;
     29using HeuristicLab.Core;
     30using HeuristicLab.Data;
     31using HeuristicLab.MainForm;
     32using HeuristicLab.MainForm.WindowsForms;
    3333
    3434namespace HeuristicLab.Optimization.Views {
     
    272272
    273273    private void UpdateMarkerSizes() {
    274       double[] sizeValues = this.chart.Series[0].Points.Select(p => p.YValues[1]).ToArray();
     274      var series = chart.Series[0];
     275      var sizeValues = series.Points.Select(p => p.YValues[1]);
     276
    275277      double minSizeValue = sizeValues.Min();
    276278      double maxSizeValue = sizeValues.Max();
    277 
    278       for (int i = 0; i < sizeValues.Length; i++) {
    279         DataPoint point = this.chart.Series[0].Points[i];
    280         double sizeRange = maxSizeValue - minSizeValue;
     279      double sizeRange = maxSizeValue - minSizeValue;
     280
     281      const int smallestBubbleSize = 5;
     282
     283      foreach (DataPoint point in series.Points) {
     284        //calculates the relative size of the data point  0 <= relativeSize <= 1
    281285        double relativeSize = (point.YValues[1] - minSizeValue);
    282 
    283         if (sizeRange > double.Epsilon) relativeSize /= sizeRange;
    284         else relativeSize = 1;
    285 
    286         point.MarkerSize = (int)Math.Round((sizeTrackBar.Value - sizeTrackBar.Minimum) * relativeSize + sizeTrackBar.Minimum);
     286        if (sizeRange > double.Epsilon) {
     287          relativeSize /= sizeRange;
     288
     289          //invert bubble sizes if the value of the trackbar is negative
     290          if (sizeTrackBar.Value < 0) relativeSize = Math.Abs(relativeSize - 1);
     291        } else relativeSize = 1;
     292
     293        double sizeChange = Math.Abs(sizeTrackBar.Value) * relativeSize;
     294        point.MarkerSize = (int)Math.Round(sizeChange + smallestBubbleSize);
    287295      }
    288296    }
Note: See TracChangeset for help on using the changeset viewer.