Ignore:
Timestamp:
04/26/10 16:43:16 (12 years ago)
Author:
mkommend
Message:

corrected axis labels in RunCollectionBubbleChartView; this also avoids GDI exceptions (ticket #970)

File:
1 edited

Legend:

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

    r3524 r3536  
    3434using HeuristicLab.Core;
    3535using HeuristicLab.Data;
     36using System.Threading;
    3637
    3738namespace HeuristicLab.Optimization.Views {
     
    178179        foreach (IRun run in this.Content)
    179180          this.AddDataPoint(run);
     181        //Thread.Sleep(100);
    180182      }
    181183    }
     
    397399      Axis xAxis = this.chart.ChartAreas[0].AxisX;
    398400      Axis yAxis = this.chart.ChartAreas[0].AxisY;
    399       SetCustomAxisLabels(xAxis, xAxisComboBox.SelectedIndex);
    400       SetCustomAxisLabels(yAxis, yAxisComboBox.SelectedIndex);
     401      int axisDimensionCount = Enum.GetNames(typeof(AxisDimension)).Count();
     402      SetCustomAxisLabels(xAxis, xAxisComboBox.SelectedIndex - axisDimensionCount);
     403      SetCustomAxisLabels(yAxis, yAxisComboBox.SelectedIndex - axisDimensionCount);
    401404    }
    402405    private void SetCustomAxisLabels(Axis axis, int dimension) {
     
    405408        CustomLabel label = null;
    406409        foreach (var pair in categoricalMapping[dimension]) {
    407           label = axis.CustomLabels.Add(pair.Value - 0.5, pair.Value + 0.5, pair.Key.ToString());
     410          string labelText = pair.Key.ToString();
     411          if(labelText.Length > 25)
     412            labelText = labelText.Substring(0,25) + " ... ";
     413          label = axis.CustomLabels.Add(pair.Value - 0.5, pair.Value + 0.5, labelText);
    408414          label.GridTicks = GridTickTypes.TickMark;
    409415        }
Note: See TracChangeset for help on using the changeset viewer.