Changeset 7541


Ignore:
Timestamp:
03/02/12 10:06:19 (7 years ago)
Author:
abeham
Message:

#1780: added dialog for setting the names, ability to include a charateristic

Location:
branches/VisualizeAsMDS/HeuristicLab.Optimizer.Tools/3.3
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • branches/VisualizeAsMDS/HeuristicLab.Optimizer.Tools/3.3

    • Property svn:ignore
      •  

        old new  
        22bin
        33obj
         4*.user
  • branches/VisualizeAsMDS/HeuristicLab.Optimizer.Tools/3.3/HeuristicLab.Optimizer.Tools-3.3.csproj

    r7526 r7541  
    9898    </Compile>
    9999    <Compile Include="MultidimensionalScalingMenuItem.cs" />
     100    <Compile Include="SetNamesDialog.cs">
     101      <SubType>Form</SubType>
     102    </Compile>
     103    <Compile Include="SetNamesDialog.Designer.cs">
     104      <DependentUpon>SetNamesDialog.cs</DependentUpon>
     105    </Compile>
    100106    <None Include="Plugin.cs.frame" />
    101107    <Compile Include="Plugin.cs" />
     
    110116      <DependentUpon>MDSView.cs</DependentUpon>
    111117    </EmbeddedResource>
     118    <EmbeddedResource Include="SetNamesDialog.resx">
     119      <DependentUpon>SetNamesDialog.cs</DependentUpon>
     120    </EmbeddedResource>
    112121  </ItemGroup>
    113122  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     
    118127set Outdir=$(Outdir)
    119128
    120 REM call PreBuildEvent.cmd</PreBuildEvent>
     129call PreBuildEvent.cmd</PreBuildEvent>
    121130  </PropertyGroup>
    122131  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/VisualizeAsMDS/HeuristicLab.Optimizer.Tools/3.3/MDSView.Designer.cs

    r7526 r7541  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.visualizeCheckBox = new System.Windows.Forms.CheckBox();
    4847      this.mdsPictureBox = new System.Windows.Forms.PictureBox();
    49       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     48      this.visualizationPanel = new System.Windows.Forms.Panel();
     49      this.setNamesButton = new System.Windows.Forms.Button();
     50      this.infoLabel = new System.Windows.Forms.Label();
     51      this.copyCoordinatesButton = new System.Windows.Forms.Button();
     52      this.drawLinesCheckBox = new System.Windows.Forms.CheckBox();
     53      this.characteristicView = new HeuristicLab.Data.Views.StringConvertibleArrayView();
     54      this.label1 = new System.Windows.Forms.Label();
    5055      ((System.ComponentModel.ISupportInitialize)(this.mdsPictureBox)).BeginInit();
     56      this.visualizationPanel.SuspendLayout();
    5157      this.SuspendLayout();
    52       //
    53       // rowsTextBox
    54       //
    55       this.errorProvider.SetIconAlignment(this.rowsTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    56       this.errorProvider.SetIconPadding(this.rowsTextBox, 2);
    57       this.rowsTextBox.Size = new System.Drawing.Size(282, 20);
    58       //
    59       // columnsTextBox
    60       //
    61       this.columnsTextBox.Size = new System.Drawing.Size(282, 20);
    62       //
    63       // visualizeCheckBox
    64       //
    65       this.visualizeCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    66       this.visualizeCheckBox.Appearance = System.Windows.Forms.Appearance.Button;
    67       this.visualizeCheckBox.Location = new System.Drawing.Point(353, 0);
    68       this.visualizeCheckBox.Name = "visualizeCheckBox";
    69       this.visualizeCheckBox.Size = new System.Drawing.Size(71, 46);
    70       this.visualizeCheckBox.TabIndex = 7;
    71       this.visualizeCheckBox.Text = "Visualize";
    72       this.visualizeCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    73       this.visualizeCheckBox.UseVisualStyleBackColor = true;
    74       this.visualizeCheckBox.CheckedChanged += new System.EventHandler(this.visualizeCheckBox_CheckedChanged);
    7558      //
    7659      // mdsPictureBox
     
    7962            | System.Windows.Forms.AnchorStyles.Left)
    8063            | System.Windows.Forms.AnchorStyles.Right)));
    81       this.mdsPictureBox.Location = new System.Drawing.Point(0, 52);
     64      this.mdsPictureBox.Location = new System.Drawing.Point(102, 32);
    8265      this.mdsPictureBox.Name = "mdsPictureBox";
    83       this.mdsPictureBox.Size = new System.Drawing.Size(424, 333);
     66      this.mdsPictureBox.Size = new System.Drawing.Size(508, 476);
    8467      this.mdsPictureBox.TabIndex = 8;
    8568      this.mdsPictureBox.TabStop = false;
    86       this.mdsPictureBox.Visible = false;
     69      //
     70      // visualizationPanel
     71      //
     72      this.visualizationPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     73            | System.Windows.Forms.AnchorStyles.Left)
     74            | System.Windows.Forms.AnchorStyles.Right)));
     75      this.visualizationPanel.Controls.Add(this.label1);
     76      this.visualizationPanel.Controls.Add(this.characteristicView);
     77      this.visualizationPanel.Controls.Add(this.setNamesButton);
     78      this.visualizationPanel.Controls.Add(this.infoLabel);
     79      this.visualizationPanel.Controls.Add(this.copyCoordinatesButton);
     80      this.visualizationPanel.Controls.Add(this.drawLinesCheckBox);
     81      this.visualizationPanel.Controls.Add(this.mdsPictureBox);
     82      this.visualizationPanel.Location = new System.Drawing.Point(0, 0);
     83      this.visualizationPanel.Name = "visualizationPanel";
     84      this.visualizationPanel.Size = new System.Drawing.Size(610, 534);
     85      this.visualizationPanel.TabIndex = 9;
     86      //
     87      // setNamesButton
     88      //
     89      this.setNamesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     90      this.setNamesButton.Location = new System.Drawing.Point(455, 3);
     91      this.setNamesButton.Name = "setNamesButton";
     92      this.setNamesButton.Size = new System.Drawing.Size(75, 23);
     93      this.setNamesButton.TabIndex = 12;
     94      this.setNamesButton.Text = "Set names...";
     95      this.setNamesButton.UseVisualStyleBackColor = true;
     96      this.setNamesButton.Click += new System.EventHandler(this.setNamesButton_Click);
     97      //
     98      // infoLabel
     99      //
     100      this.infoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
     101            | System.Windows.Forms.AnchorStyles.Right)));
     102      this.infoLabel.Location = new System.Drawing.Point(3, 511);
     103      this.infoLabel.Name = "infoLabel";
     104      this.infoLabel.Size = new System.Drawing.Size(604, 23);
     105      this.infoLabel.TabIndex = 11;
     106      this.infoLabel.Text = "-";
     107      this.infoLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     108      //
     109      // copyCoordinatesButton
     110      //
     111      this.copyCoordinatesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     112      this.copyCoordinatesButton.Location = new System.Drawing.Point(536, 3);
     113      this.copyCoordinatesButton.Name = "copyCoordinatesButton";
     114      this.copyCoordinatesButton.Size = new System.Drawing.Size(71, 23);
     115      this.copyCoordinatesButton.TabIndex = 10;
     116      this.copyCoordinatesButton.Text = "Copy";
     117      this.copyCoordinatesButton.UseVisualStyleBackColor = true;
     118      this.copyCoordinatesButton.Click += new System.EventHandler(this.copyCoordinatesButton_Click);
     119      //
     120      // drawLinesCheckBox
     121      //
     122      this.drawLinesCheckBox.AutoSize = true;
     123      this.drawLinesCheckBox.Location = new System.Drawing.Point(3, 7);
     124      this.drawLinesCheckBox.Name = "drawLinesCheckBox";
     125      this.drawLinesCheckBox.Size = new System.Drawing.Size(73, 17);
     126      this.drawLinesCheckBox.TabIndex = 9;
     127      this.drawLinesCheckBox.Text = "draw lines";
     128      this.drawLinesCheckBox.UseVisualStyleBackColor = true;
     129      this.drawLinesCheckBox.CheckedChanged += new System.EventHandler(this.drawLinesCheckBox_CheckedChanged);
     130      //
     131      // characteristicView
     132      //
     133      this.characteristicView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     134            | System.Windows.Forms.AnchorStyles.Left)));
     135      this.characteristicView.Caption = "StringConvertibleArray View";
     136      this.characteristicView.Content = null;
     137      this.characteristicView.Location = new System.Drawing.Point(3, 53);
     138      this.characteristicView.Name = "characteristicView";
     139      this.characteristicView.ReadOnly = false;
     140      this.characteristicView.Size = new System.Drawing.Size(93, 455);
     141      this.characteristicView.TabIndex = 13;
     142      //
     143      // label1
     144      //
     145      this.label1.AutoSize = true;
     146      this.label1.Location = new System.Drawing.Point(0, 32);
     147      this.label1.Name = "label1";
     148      this.label1.Size = new System.Drawing.Size(74, 13);
     149      this.label1.TabIndex = 14;
     150      this.label1.Text = "Characteristic:";
    87151      //
    88152      // MDSView
     
    90154      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    91155      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    92       this.Controls.Add(this.mdsPictureBox);
    93       this.Controls.Add(this.visualizeCheckBox);
     156      this.Controls.Add(this.visualizationPanel);
    94157      this.Name = "MDSView";
    95       this.Controls.SetChildIndex(this.visualizeCheckBox, 0);
    96       this.Controls.SetChildIndex(this.mdsPictureBox, 0);
    97       this.Controls.SetChildIndex(this.statisticsTextBox, 0);
    98       this.Controls.SetChildIndex(this.rowsLabel, 0);
    99       this.Controls.SetChildIndex(this.columnsLabel, 0);
    100       this.Controls.SetChildIndex(this.rowsTextBox, 0);
    101       this.Controls.SetChildIndex(this.columnsTextBox, 0);
    102       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
     158      this.Size = new System.Drawing.Size(610, 534);
    103159      ((System.ComponentModel.ISupportInitialize)(this.mdsPictureBox)).EndInit();
     160      this.visualizationPanel.ResumeLayout(false);
     161      this.visualizationPanel.PerformLayout();
    104162      this.ResumeLayout(false);
    105       this.PerformLayout();
    106163
    107164    }
     
    109166    #endregion
    110167
    111     private System.Windows.Forms.CheckBox visualizeCheckBox;
    112168    private System.Windows.Forms.PictureBox mdsPictureBox;
     169    private System.Windows.Forms.Panel visualizationPanel;
     170    private System.Windows.Forms.CheckBox drawLinesCheckBox;
     171    private System.Windows.Forms.Button copyCoordinatesButton;
     172    private System.Windows.Forms.Label infoLabel;
     173    private System.Windows.Forms.Button setNamesButton;
     174    private Data.Views.StringConvertibleArrayView characteristicView;
     175    private System.Windows.Forms.Label label1;
    113176
    114177  }
  • branches/VisualizeAsMDS/HeuristicLab.Optimizer.Tools/3.3/MDSView.cs

    r7526 r7541  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Drawing;
    2425using System.Globalization;
     26using System.Linq;
    2527using System.Text;
    2628using System.Text.RegularExpressions;
     29using System.Windows.Forms;
    2730using HeuristicLab.Analysis;
     31using HeuristicLab.Common;
     32using HeuristicLab.Core.Views;
    2833using HeuristicLab.Data;
    29 using HeuristicLab.Data.Views;
    3034using HeuristicLab.MainForm;
    3135using HeuristicLab.MainForm.WindowsForms;
     
    3337namespace HeuristicLab.Optimizer.Tools {
    3438  [View("MDSView")]
    35   [Content(typeof(IStringConvertibleMatrix), IsDefaultView = false)]
    36   public partial class MDSView : StringConvertibleMatrixView {
     39  [Content(typeof(DoubleMatrix), IsDefaultView = false)]
     40  public partial class MDSView : ItemView {
     41
     42    private static Color[] KellysDistinguishableColors = new Color[] {
     43      Color.FromArgb(0xFF, Color.FromArgb(0xFFB300)),
     44      Color.FromArgb(0xFF, Color.FromArgb(0x803E75)),
     45      Color.FromArgb(0xFF, Color.FromArgb(0xFF6800)),
     46      Color.FromArgb(0xFF, Color.FromArgb(0xA6BDD7)),
     47      Color.FromArgb(0xFF, Color.FromArgb(0xC10020)),
     48      Color.FromArgb(0xFF, Color.FromArgb(0xCEA262)),
     49      Color.FromArgb(0xFF, Color.FromArgb(0x817066)),
     50      Color.FromArgb(0xFF, Color.FromArgb(0x007D34)),
     51      Color.FromArgb(0xFF, Color.FromArgb(0xF6768E)),
     52      Color.FromArgb(0xFF, Color.FromArgb(0x00538A)),
     53      Color.FromArgb(0xFF, Color.FromArgb(0x53377A)),
     54      Color.FromArgb(0xFF, Color.FromArgb(0xB32851)),
     55      Color.FromArgb(0xFF, Color.FromArgb(0x7F180D)),
     56      Color.FromArgb(0xFF, Color.FromArgb(0x93AA00)),
     57      Color.FromArgb(0xFF, Color.FromArgb(0x593315)),
     58      Color.FromArgb(0xFF, Color.FromArgb(0xF13A13)),
     59      Color.FromArgb(0xFF, Color.FromArgb(0x232C16)),
     60    };
     61
     62    public new DoubleMatrix Content {
     63      get { return (DoubleMatrix)base.Content; }
     64      set { base.Content = value; }
     65    }
     66
     67    private DoubleArray Characteristic { get; set; }
    3768
    3869    public MDSView() {
    3970      InitializeComponent();
     71      Characteristic = new DoubleArray();
     72      characteristicView.Content = Characteristic;
    4073    }
    4174
     
    5992    protected override void OnContentChanged() {
    6093      base.OnContentChanged();
     94      if (Content != null && Content.Rows != Characteristic.Length)
     95        ((IStringConvertibleArray)Characteristic).Length = Content.Rows;
    6196      OnRedraw();
    6297    }
     
    6499    protected override void SetEnabledStateOfControls() {
    65100      base.SetEnabledStateOfControls();
    66       visualizeCheckBox.Enabled = Content != null && Content.Rows == Content.Columns && Content.Rows > 0;
    67       mdsPictureBox.Visible = visualizeCheckBox.Enabled && visualizeCheckBox.Checked;
    68     }
    69 
    70     private void visualizeCheckBox_CheckedChanged(object sender, System.EventArgs e) {
    71       mdsPictureBox.Visible = visualizeCheckBox.Checked;
     101      visualizationPanel.Enabled = Content != null && Content.Rows == Content.Columns && Content.Rows > 0;
     102    }
     103
     104    private void drawLinesCheckBox_CheckedChanged(object sender, EventArgs e) {
    72105      OnRedraw();
     106    }
     107
     108    private void setNamesButton_Click(object sender, EventArgs e) {
     109      SetNamesDialog dialog = null;
     110      if (Content.RowNames != null && Content.RowNames.Any())
     111        dialog = new SetNamesDialog(Content.RowNames);
     112      else dialog = new SetNamesDialog(Content.Rows);
     113
     114      try {
     115        if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
     116          Content.RowNames = dialog.Names;
     117          Content.ColumnNames = dialog.Names;
     118          OnRedraw();
     119        }
     120      } finally {
     121        dialog.Dispose();
     122      }
     123    }
     124
     125    private void copyCoordinatesButton_Click(object sender, EventArgs e) {
     126      try {
     127        var coordinates = MultidimensionalScaling.KruskalShepard(Content);
     128        StringBuilder s = new StringBuilder();
     129
     130        for (int i = 0; i < coordinates.Rows; i++) {
     131          s.Append(coordinates[i, 0].ToString());
     132          s.Append('\t');
     133          s.Append(coordinates[i, 1].ToString());
     134          s.Append(Environment.NewLine);
     135        }
     136
     137        Clipboard.SetText(s.ToString());
     138      } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Error: " + ex.ToString()); }
    73139    }
    74140
     
    77143        Invoke((Action)OnRedraw, null);
    78144      } else {
    79         if (!mdsPictureBox.Visible) return;
     145        if (!visualizationPanel.Visible) return;
    80146        GenerateImage();
    81147      }
     
    99165      DoubleMatrix coordinates;
    100166      double stress = double.NaN;
    101       DoubleMatrix matrix = new DoubleMatrix(Content.Rows, Content.Columns, Content.ColumnNames, Content.RowNames);
    102167      try {
    103         for (int i = 0; i < Content.Rows; i++)
    104           for (int j = 0; j < Content.Columns; j++)
    105             matrix[i, j] = double.Parse(Content.GetValue(i, j));
    106         coordinates = MultidimensionalScaling.KruskalShepard(matrix);
    107         stress = MultidimensionalScaling.CalculateNormalizedStress(matrix, coordinates);
    108         statisticsTextBox.Text = "Stress: " + stress.ToString("0.00", CultureInfo.CurrentCulture.NumberFormat);
     168        coordinates = MultidimensionalScaling.KruskalShepard(Content);
     169        stress = MultidimensionalScaling.CalculateNormalizedStress(Content, coordinates);
     170        infoLabel.Text = "Stress: " + stress.ToString("0.00", CultureInfo.CurrentCulture.NumberFormat);
    109171      } catch {
    110172        WriteCenteredTextToBitmap(ref newBitmap, "Matrix is not symmetric");
    111         statisticsTextBox.Text = "-";
     173        infoLabel.Text = "-";
    112174        return newBitmap;
    113175      }
     
    121183
    122184        for (int j = i + 1; j < coordinates.Rows; j++) {
    123           if (matrix[i, j] > maxDistance) maxDistance = matrix[i, j];
    124           if (matrix[j, i] > maxDistance) maxDistance = matrix[j, i];
     185          if (Content[i, j] > maxDistance) maxDistance = Content[i, j];
     186          if (Content[j, i] > maxDistance) maxDistance = Content[j, i];
    125187        }
    126188      }
     
    138200      using (Graphics graphics = Graphics.FromImage(newBitmap)) {
    139201        graphics.Clear(Color.White);
    140         graphics.DrawString("Showing entities spaced out according to their distances.", Font, Brushes.Black, 5, 2);
    141 
    142         for (int i = 0; i < coordinates.Rows - 1; i++) {
    143           for (int j = i + 1; j < coordinates.Rows; j++) {
    144             Point start = points[i], end = points[j];
    145             string caption = String.Empty;
    146             double d = Math.Max(matrix[i, j], matrix[j, i]);
    147             float width = (float)Math.Ceiling(5.0 * d / maxDistance);
    148             if (d > 0) {
    149               graphics.DrawLine(new Pen(Color.IndianRed, width), start, end);
    150               if (matrix[i, j] != matrix[j, i])
    151                 caption = matrix[i, j].ToString(CultureInfo.InvariantCulture.NumberFormat)
    152                   + " / " + matrix[j, i].ToString(CultureInfo.InvariantCulture.NumberFormat);
    153               else
    154                 caption = matrix[i, j].ToString(CultureInfo.InvariantCulture.NumberFormat);
     202
     203        if (drawLinesCheckBox.Checked) {
     204          for (int i = 0; i < coordinates.Rows - 1; i++) {
     205            for (int j = i + 1; j < coordinates.Rows; j++) {
     206              Point start = points[i], end = points[j];
     207              string caption = String.Empty;
     208              double d = Math.Max(Content[i, j], Content[j, i]);
     209              float width = (float)Math.Ceiling(5.0 * d / maxDistance);
     210              if (d > 0) {
     211                graphics.DrawLine(new Pen(Color.IndianRed, width), start, end);
     212                if (Content[i, j] != Content[j, i])
     213                  caption = Content[i, j].ToString(CultureInfo.InvariantCulture.NumberFormat)
     214                    + " / " + Content[j, i].ToString(CultureInfo.InvariantCulture.NumberFormat);
     215                else
     216                  caption = Content[i, j].ToString(CultureInfo.InvariantCulture.NumberFormat);
     217              }
     218              if (!String.IsNullOrEmpty(caption)) {
     219                double r = rand.NextDouble();
     220                while (r < 0.2 || r > 0.8) r = rand.NextDouble();
     221                float x = (float)(start.X + (end.X - start.X) * r + 5);
     222                float y = (float)(start.Y + (end.Y - start.Y) * r + 5);
     223                graphics.DrawString(caption, Font, Brushes.Black, x, y);
     224              }
    155225            }
    156             if (!String.IsNullOrEmpty(caption)) {
    157               double r = rand.NextDouble();
    158               while (r < 0.2 || r > 0.8) r = rand.NextDouble();
    159               float x = (float)(start.X + (end.X - start.X) * r + 5);
    160               float y = (float)(start.Y + (end.Y - start.Y) * r + 5);
    161               graphics.DrawString(caption, Font, Brushes.Black, x, y);
     226          }
     227        }
     228
     229        string[] rowNames = null;
     230        if (Content.RowNames != null && Content.RowNames.Any())
     231          rowNames = Content.RowNames.ToArray();
     232        double min = Characteristic.Min(), max = Characteristic.Max();
     233        if (min == max) {
     234          var colorCodes = new Dictionary<string, int>();
     235          for (int i = 0; i < points.Length; i++) {
     236            Point p = new Point(points[i].X - 3, points[i].Y - 3);
     237            if (rowNames == null || (rowNames != null && i >= rowNames.Length)) {
     238              graphics.FillRectangle(Brushes.Black, p.X, p.Y, 8, 8);
     239              graphics.DrawString(i.ToString(), Font, Brushes.Black, p.X, p.Y + 10);
     240            } else {
     241              string pre = rowNames[i].Substring(0, 3);
     242              string post = rowNames[i].Substring(3);
     243              if (!colorCodes.ContainsKey(pre)) colorCodes[pre] = !colorCodes.Any() ? 0 : colorCodes.Values.Max() + 1;
     244              var brush = new SolidBrush(KellysDistinguishableColors[colorCodes[pre]]);
     245              var size = TextRenderer.MeasureText(post, Font);
     246              graphics.FillRectangle(brush, p.X, p.Y, 8, 8);
     247              graphics.DrawString(post, Font, brush, p.X - (size.Width / 2.0f), p.Y + 10);
    162248            }
    163249          }
    164         }
    165 
    166         for (int i = 0; i < points.Length; i++) {
    167           Point p = new Point(points[i].X - 3, points[i].Y - 3);
    168           graphics.FillRectangle(Brushes.Black, p.X, p.Y, 8, 8);
    169           graphics.DrawString(i.ToString(), Font, Brushes.Black, p.X, p.Y + 10);
     250
     251          int offset = 1;
     252          foreach (var code in colorCodes) {
     253            using (var brush = new SolidBrush(KellysDistinguishableColors[code.Value])) {
     254              graphics.DrawString(code.Key, Font, brush, 5, 40 + offset * 20);
     255            }
     256            offset++;
     257          }
     258        } else {
     259          var colors = ColorGradient.Colors.ToArray();
     260          for (int i = 0; i < points.Length; i++) {
     261            Point p = new Point(points[i].X - 3, points[i].Y - 3);
     262            double interpolation = Math.Sqrt((Characteristic[i] - min) / (max - min));
     263            Color c = colors[(int)Math.Floor((colors.Length - 1) * interpolation)];
     264            var brush = new SolidBrush(c);
     265            graphics.FillRectangle(brush, p.X, p.Y, 8, 8);
     266            if (rowNames == null || (rowNames != null && i >= rowNames.Length)) {
     267              graphics.DrawString(i.ToString(), Font, brush, p.X, p.Y + 10);
     268            } else {
     269              var size = TextRenderer.MeasureText(rowNames[i], Font);
     270              graphics.DrawString(rowNames[i], Font, brush, p.X - (size.Width / 2.0f), p.Y + 10);
     271            }
     272          }
    170273        }
    171274      }
  • branches/VisualizeAsMDS/HeuristicLab.Optimizer.Tools/3.3/MDSView.resx

    r7526 r7541  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
    120   <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    121     <value>141, 17</value>
    122   </metadata>
    123120</root>
  • branches/VisualizeAsMDS/HeuristicLab.Optimizer.Tools/3.3/Plugin.cs.frame

    r7526 r7541  
    2525  [Plugin("HeuristicLab.Optimizer.Tools", "3.3.6.$WCREV$")]
    2626  [PluginFile("HeuristicLab.Optimizer.Tools-3.3.dll", PluginFileType.Assembly)]
    27   [PluginDependency("HeuristicLab.ALGLIB", "3.3")]
     27  [PluginDependency("HeuristicLab.ALGLIB", "3.4")]
    2828  [PluginDependency("HeuristicLab.Analysis", "3.3")]
    2929  [PluginDependency("HeuristicLab.Collections", "3.3")]
Note: See TracChangeset for help on using the changeset viewer.