Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/06/15 11:32:59 (9 years ago)
Author:
pfleck
Message:

#2379 Fixed wrong keys for categorical mapping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/BubbleChartView.cs

    r12554 r12595  
    200200                  series.Points.Add(new DataPoint(x, new[] { y, s }));
    201201            }
    202 
    203202          }
    204203        }
     
    216215          return parent.Children
    217216            .Where(child => child.Data.ContainsKey(dataKey))
    218             .Select(child => ConvertToDouble(child.Data[dataKey], child, dataKey));
     217            .Select(child => ConvertToDouble(child, dataKey));
    219218        }
    220219        return Enumerable.Empty<double>();
     
    231230          return GetValue(item, sizeDimension).ToEnumerable();
    232231        } else if (item.Data.ContainsKey(key)) {
    233           IItem value = item.Data[key];
    234           return ConvertToDouble(value, item, key).ToEnumerable();
     232
     233          return ConvertToDouble(item, key).ToEnumerable();
    235234        } else {
    236235          return Enumerable.Empty<double>();
     
    239238    }
    240239
    241     private double ConvertToDouble(IItem value, RecursiveDataItem item, string key) {
     240    private double ConvertToDouble(RecursiveDataItem item, string key) {
     241      IItem value = item.Data[key];
    242242      var doubleValue = value as DoubleValue;
    243243      var intValue = value as IntValue;
     
    252252        ret = timeSpanValue.Value.TotalSeconds;
    253253      else
    254         ret = GetCategoricalValue(item, key, value.ToString());
     254        ret = GetCategoricalValue(key, value.ToString());
    255255      return ret.Value;
    256256    }
    257257
    258     private double? GetCategoricalValue(RecursiveDataItem item, string key, string value) {
     258    private double? GetCategoricalValue(string key, string value) {
    259259      if (!categoricalMapping.ContainsKey(key)) {
    260260        categoricalMapping[key] = new Dictionary<object, double>();
     
    322322    }
    323323    private void SetCustomAxisLabels(Axis axis, string key) {
     324      if (key == null) return;
     325      var tokens = key.Split(new[] { Separator }, StringSplitOptions.RemoveEmptyEntries);
     326      if (tokens.Length == 2)
     327        key = tokens[1];
    324328      axis.CustomLabels.Clear();
    325       if (key != null && categoricalMapping.ContainsKey(key)) {
     329      if (categoricalMapping.ContainsKey(key)) {
    326330        foreach (var pair in categoricalMapping[key]) {
    327331          string labelText = pair.Key.ToString();
     
    336340          axis.CustomLabels.Add(label);
    337341        }
    338       } else if (false && key != null && Content.Data[key] is TimeSpanValue) { // TODO
     342      } else if (Content.Data.ContainsKey(key) && Content.Data[key] is TimeSpanValue) { // TODO
    339343        chart.ChartAreas[0].RecalculateAxesScale();
    340344        for (double i = axis.Minimum; i <= axis.Maximum; i += axis.LabelStyle.Interval) {
Note: See TracChangeset for help on using the changeset viewer.