Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/09 18:38:47 (15 years ago)
Author:
gkronber
Message:

Show actual X and Y values in the tooltip. This is important for sub-entry bubble charts where the actual values are hidden in enumerations. #286 (Variable-usage diagrams for the CEDMA frontend)

Location:
trunk/sources/HeuristicLab.CEDMA.Charting/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChart.cs

    r2131 r2132  
    6767      records = new List<ResultsEntry>();
    6868      primitiveToEntryDictionary = new Dictionary<IPrimitive, ResultsEntry>();
    69       // entryToPrimitivesDictionary = new Dictionary<ResultsEntry, IList<IPrimitive>>();
     69      //entryToPrimitivesDictionary = new Dictionary<ResultsEntry, IList<IPrimitive>>();
    7070      this.results = results;
    7171
     
    133133      Group.Clear();
    134134      primitiveToEntryDictionary.Clear();
    135       // entryToPrimitivesDictionary.Clear();
     135      //entryToPrimitivesDictionary.Clear();
    136136      points = new Group(this);
    137137      Group.Add(new Axis(this, 0, 0, AxisType.Both));
     
    140140        List<double> xs = new List<double>();
    141141        List<double> ys = new List<double>();
     142        List<object> actualXValues = new List<object>();
     143        List<object> actualYValues = new List<object>();
    142144        int size;
    143145        if (results.OrdinalVariables.Contains(xDimension)) {
    144146          xs.Add(Convert.ToDouble(r.Get(xDimension)) + (double)r.Get(X_JITTER) * xJitterFactor);
     147          actualXValues.Add(r.Get(xDimension));
    145148        } else if (results.CategoricalVariables.Contains(xDimension)) {
    146149          xs.Add(results.IndexOfCategoricalValue(xDimension, r.Get(xDimension)) + (double)r.Get(X_JITTER) * xJitterFactor);
     150          actualXValues.Add(r.Get(xDimension));
    147151        } else if (results.MultiDimensionalCategoricalVariables.Contains(xDimension)) {
    148152          var path = xDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
     
    150154          foreach (ResultsEntry subEntry in subEntries) {
    151155            xs.Add(results.IndexOfCategoricalValue(xDimension, subEntry.Get(path.ElementAt(1))) + (double)r.Get(X_JITTER) * xJitterFactor);
     156            actualXValues.Add(subEntry.Get(path.ElementAt(1)));
    152157          }
    153158        } else if (results.MultiDimensionalOrdinalVariables.Contains(xDimension)) {
     
    156161          foreach (ResultsEntry subEntry in subEntries) {
    157162            xs.Add(Convert.ToDouble(subEntry.Get(path.ElementAt(1))) + (double)r.Get(X_JITTER) * xJitterFactor);
     163            actualXValues.Add(subEntry.Get(path.ElementAt(1)));
    158164          }
    159165        } else {
    160166          xs.Add(double.NaN);
     167          actualXValues.Add("NaN");
    161168        }
    162169        if (results.OrdinalVariables.Contains(yDimension)) {
    163170          ys.Add(Convert.ToDouble(r.Get(yDimension)) + (double)r.Get(Y_JITTER) * yJitterFactor);
     171          actualYValues.Add(r.Get(yDimension));
    164172        } else if (results.CategoricalVariables.Contains(yDimension)) {
    165173          ys.Add(results.IndexOfCategoricalValue(yDimension, r.Get(yDimension)) + (double)r.Get(Y_JITTER) * yJitterFactor);
     174          actualYValues.Add(r.Get(yDimension));
    166175        } else if (results.MultiDimensionalCategoricalVariables.Contains(yDimension)) {
    167176          var path = yDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
     
    169178          foreach (ResultsEntry subEntry in subEntries) {
    170179            ys.Add(results.IndexOfCategoricalValue(yDimension, subEntry.Get(path.ElementAt(1))) + (double)r.Get(Y_JITTER) * yJitterFactor);
     180            actualYValues.Add(subEntry.Get(path.ElementAt(1)));
    171181          }
    172182        } else if (results.MultiDimensionalOrdinalVariables.Contains(yDimension)) {
     
    175185          foreach (ResultsEntry subEntry in subEntries) {
    176186            ys.Add(Convert.ToDouble(subEntry.Get(path.ElementAt(1))) + (double)r.Get(Y_JITTER) * yJitterFactor);
     187            actualYValues.Add(subEntry.Get(path.ElementAt(1)));
    177188          }
    178189        } else {
    179190          ys.Add(double.NaN);
     191          actualYValues.Add("NaN");
    180192        }
    181193        size = CalculateSize(Convert.ToDouble(r.Get(sizeDimension)), minSize, maxSize);
     
    183195        int n = Math.Max(xs.Count(), ys.Count());
    184196        for (int i = 0; i < n; i++) {
    185           double x = xs[Math.Min(i, xs.Count()-1)];
    186           double y = ys[Math.Min(i, ys.Count()-1)];
     197          double x = xs[Math.Min(i, xs.Count() - 1)];
     198          double y = ys[Math.Min(i, ys.Count() - 1)];
     199          string actualXValue = actualXValues[Math.Min(i, actualXValues.Count() - 1)].ToString();
     200          string actualYValue = actualYValues[Math.Min(i, actualYValues.Count() - 1)].ToString();
    187201          if (double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN;
    188202          if (double.IsInfinity(y) || y == double.MaxValue || y == double.MinValue) y = double.NaN;
     
    193207            Brush brush = pen.Brush;
    194208            FixedSizeCircle c = new FixedSizeCircle(this, x, y, size, pen, brush);
    195             c.ToolTipText = r.GetToolTipText();
     209            c.ToolTipText = xDimension + " = " + actualXValue + Environment.NewLine +
     210              yDimension + " = " + actualYValue + Environment.NewLine +
     211              r.GetToolTipText();
    196212            points.Add(c);
    197213            if (!r.Selected) c.IntoBackground();
  • trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartControl.cs

    r1529 r2132  
    3636    private Point mousePosition;
    3737    private Point buttonDownPoint;
     38    private IPrimitive primitiveUnderCursor;
    3839
    3940    private BubbleChart myChart;
     
    107108    }
    108109    private void pictureBox_MouseMove(object sender, MouseEventArgs e) {
    109       toolTip.SetToolTip(pictureBox, Chart.GetToolTipText(e.Location));
     110      if (Chart.GetPrimitive(e.Location) != primitiveUnderCursor) {
     111        primitiveUnderCursor = Chart.GetPrimitive(e.Location);
     112        toolTip.SetToolTip(pictureBox, Chart.GetToolTipText(e.Location));
     113      }
    110114      if(e.Button != MouseButtons.None) {
    111115        if((Chart.Mode == ChartMode.Zoom || Chart.Mode == ChartMode.Select) && (e.Button == MouseButtons.Left)) {
Note: See TracChangeset for help on using the changeset viewer.