Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15267


Ignore:
Timestamp:
07/17/17 22:02:39 (7 years ago)
Author:
mkommend
Message:

#2810: Merged r15264, r15265, r15266 to stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Optimization.Views

  • stable/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs

    r15161 r15267  
    435435        return GetValue(run, sizeDimension);
    436436      } else {
    437         int columnIndex = Matrix.ColumnNames.ToList().IndexOf(columnName);
    438         IItem value = Content.GetValue(run, columnIndex);
     437
     438        IItem value = Content.GetValue(run, columnName);
    439439        if (value == null)
    440440          return null;
     
    451451        else if (timeSpanValue != null) {
    452452          ret = timeSpanValue.Value.TotalSeconds;
    453         } else
     453        } else {
     454          int columnIndex = Matrix.ColumnNames.ToList().IndexOf(columnName);
    454455          ret = GetCategoricalValue(columnIndex, value.ToString());
     456        }
    455457
    456458        return ret;
     
    622624      tooltip = run.Name + System.Environment.NewLine;
    623625
    624       double? xValue = this.GetValue(run, (string)xAxisComboBox.SelectedItem);
    625       double? yValue = this.GetValue(run, (string)yAxisComboBox.SelectedItem);
    626       double? sizeValue = this.GetValue(run, (string)sizeComboBox.SelectedItem);
    627 
    628       string xString = xValue == null ? string.Empty : xValue.Value.ToString();
    629       string yString = yValue == null ? string.Empty : yValue.Value.ToString();
    630       string sizeString = sizeValue == null ? string.Empty : sizeValue.Value.ToString();
    631 
    632       //code to handle TimeSpanValues correct
    633       int axisDimensionCount = Enum.GetNames(typeof(AxisDimension)).Count();
    634       int columnIndex = xAxisComboBox.SelectedIndex - axisDimensionCount;
    635       if (xValue.HasValue && columnIndex > 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) {
    636         TimeSpan time = TimeSpan.FromSeconds(xValue.Value);
    637         xString = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.Seconds);
    638       }
    639       columnIndex = yAxisComboBox.SelectedIndex - axisDimensionCount;
    640       if (yValue.HasValue && columnIndex > 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) {
    641         TimeSpan time = TimeSpan.FromSeconds(yValue.Value);
    642         yString = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.Seconds);
    643       }
     626      string xString = GetTooltipValue(run, (string)xAxisComboBox.SelectedItem);
     627      string yString = GetTooltipValue(run, (string)yAxisComboBox.SelectedItem);
     628      string sizeString = GetTooltipValue(run, (string)sizeComboBox.SelectedItem);
    644629
    645630      tooltip += xAxisComboBox.SelectedItem + " : " + xString + Environment.NewLine;
     
    648633
    649634      return tooltip;
     635    }
     636
     637    private string GetTooltipValue(IRun run, string columnName) {
     638      if (columnName == SizeDimension.Constant.ToString())
     639        return string.Empty;
     640
     641      int columnIndex = Matrix.ColumnNames.ToList().IndexOf(columnName);
     642
     643      //handle non-numeric values correctly
     644      if (categoricalMapping.ContainsKey(columnIndex)) {
     645        return Content.GetValue(run, columnName).ToString();
     646      }
     647
     648      double? value = GetValue(run, columnName);
     649      if (!value.HasValue) return string.Empty;
     650
     651      string valueString = value.Value.ToString();
     652
     653      //code to handle TimeSpanValues correctly
     654      if (columnIndex > 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) {
     655        TimeSpan time = TimeSpan.FromSeconds(value.Value);
     656        valueString = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.Seconds);
     657      }
     658
     659      return valueString;
    650660    }
    651661    #endregion
Note: See TracChangeset for help on using the changeset viewer.