Changeset 4212


Ignore:
Timestamp:
08/13/10 13:08:35 (9 years ago)
Author:
mkommend
Message:

Added tooltips for customized axis labels in BubbleChartView (ticket #1135)

File:
1 edited

Legend:

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

    r4209 r4212  
    431431        }
    432432      }
     433
    433434      string newTooltipText = string.Empty;
    434435      string oldTooltipText;
     
    436437        IRun run = (IRun)((DataPoint)h.Object).Tag;
    437438        newTooltipText = BuildTooltip(run);
     439      } else if (h.ChartElementType == ChartElementType.AxisLabels) {
     440        newTooltipText = ((CustomLabel)h.Object).ToolTip;
    438441      }
    439442
     
    460463      if (xValue.HasValue && columnIndex > 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) {
    461464        TimeSpan time = TimeSpan.FromSeconds(xValue.Value);
    462         xString = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.TotalSeconds);
     465        xString = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.Seconds);
    463466      }
    464467      columnIndex = yAxisComboBox.SelectedIndex - axisDimensionCount;
    465468      if (yValue.HasValue && columnIndex > 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) {
    466469        TimeSpan time = TimeSpan.FromSeconds(yValue.Value);
    467         yString = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.TotalSeconds);
     470        yString = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.Seconds);
    468471      }
    469472
     
    512515      axis.CustomLabels.Clear();
    513516      if (categoricalMapping.ContainsKey(dimension)) {
    514         CustomLabel label = null;
    515517        foreach (var pair in categoricalMapping[dimension]) {
    516518          string labelText = pair.Key.ToString();
     519          CustomLabel label = new CustomLabel();
     520          label.ToolTip = labelText;
    517521          if (labelText.Length > 25)
    518522            labelText = labelText.Substring(0, 25) + " ... ";
    519           label = axis.CustomLabels.Add(pair.Value - 0.5, pair.Value + 0.5, labelText);
     523          label.Text = labelText;
    520524          label.GridTicks = GridTickTypes.TickMark;
    521         }
    522         axis.IsLabelAutoFit = false;
    523         axis.LabelStyle.Enabled = true;
    524         axis.LabelStyle.Angle = 0;
    525         axis.LabelStyle.TruncatedLabels = true;
     525          label.FromPosition = pair.Value - 0.5;
     526          label.ToPosition = pair.Value + 0.5;
     527          axis.CustomLabels.Add(label);
     528        }
    526529      } else if (dimension > 0 && Content.GetValue(0, dimension) is TimeSpanValue) {
    527530        this.chart.ChartAreas[0].RecalculateAxesScale();
Note: See TracChangeset for help on using the changeset viewer.