+ n = prio_tree_next(&iter);
+ if (!n)
+ continue;
+
+ do {
+ struct graph_value *v;
+ double xval, xdiff;
+
+ v = container_of(n, struct graph_value, node);
+ xval = getx(v);
+
+ if (xval > x)
+ xdiff = xval - x;
+ else
+ xdiff = x - xval;
+
+ /*
+ * zero delta, or within or match critera, break
+ */
+ if (xdiff < best_delta) {
+ best_delta = xdiff;
+ if (!best_delta ||
+ (xval >= minx && xval <= maxx)) {
+ best = v;
+ break;
+ }
+ }
+ } while ((n = prio_tree_next(&iter)) != NULL);
+
+ /*
+ * If we got matches in one label, don't check others.
+ */
+ break;
+ } while ((i = i->next) != NULL);
+
+ if (best)
+ return best->tooltip;