You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ea...@apache.org on 2017/06/30 23:48:28 UTC

qpid-dispatch git commit: DISPATCH-430 Use linear interpolation on rate charts to prevent tooltip from drawing in the wrong y position

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 2b15c8f5f -> 6f408b072


DISPATCH-430 Use linear interpolation on rate charts to prevent tooltip from drawing in the wrong y position


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/6f408b07
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/6f408b07
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/6f408b07

Branch: refs/heads/master
Commit: 6f408b0726e0f9cc9ddf6920aa177af4b9d375d2
Parents: 2b15c8f
Author: Ernest Allen <ea...@redhat.com>
Authored: Fri Jun 30 19:48:13 2017 -0400
Committer: Ernest Allen <ea...@redhat.com>
Committed: Fri Jun 30 19:48:13 2017 -0400

----------------------------------------------------------------------
 .../stand-alone/plugin/js/qdrChartService.js    | 33 ++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6f408b07/console/stand-alone/plugin/js/qdrChartService.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrChartService.js b/console/stand-alone/plugin/js/qdrChartService.js
index 18e1ab7..98b5d50 100644
--- a/console/stand-alone/plugin/js/qdrChartService.js
+++ b/console/stand-alone/plugin/js/qdrChartService.js
@@ -969,8 +969,10 @@ var QDR = (function(QDR) {
                   .range([height - margin.top - margin.bottom, 0]);
               }
               if (attrs.type == "rate") {
-                area.interpolate("basis"); // rate charts look better smoothed
-                line.interpolate("basis");
+                area.interpolate("linear"); // rate charts look better smoothed, but the tooltop is in the wrong place
+                line.interpolate("linear");
+//                area.interpolate("basis"); // rate charts look better smoothed
+//                line.interpolate("basis");
               } else {
                 area.interpolate("linear"); // don't smooth value charts
                 line.interpolate("linear");
@@ -1150,3 +1152,30 @@ var QDR = (function(QDR) {
 
   return QDR;
 }(QDR || {}));
+
+// see https://stackoverflow.com/questions/11503151/in-d3-how-to-get-the-interpolated-line-data-from-a-svg-line/39442651#
+var findYatXbyBisection = function(x, path, error){
+  var length_end = path.getTotalLength()
+    , length_start = 0
+    , point = path.getPointAtLength((length_end + length_start) / 2) // get the middle point
+    , bisection_iterations_max = 50
+    , bisection_iterations = 0
+
+  error = error || 0.01
+
+  while (x < point.x - error || x > point.x + error) {
+    // get the middle point
+    point = path.getPointAtLength((length_end + length_start) / 2)
+
+    if (x < point.x) {
+      length_end = (length_start + length_end)/2
+    } else {
+      length_start = (length_start + length_end)/2
+    }
+
+    // Increase iteration
+    if(bisection_iterations_max < ++ bisection_iterations)
+      break;
+  }
+  return point.y
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org