Przeglądaj źródła

[search] Workaround for wrong X positioning of bar tooltips

Enrico Berti 10 lat temu
rodzic
commit
b8e03cd

+ 1 - 1
desktop/core/src/desktop/static/desktop/js/nv.d3.growingDiscreteBarChart.js

@@ -65,7 +65,7 @@ nv.models.growingDiscreteBarChart = function() {
   //------------------------------------------------------------
 
   var showTooltip = function(e, offsetElement) {
-    var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+    var left = e.e.clientX,
         top = e.pos[1] + ( offsetElement.offsetTop || 0),
         x = xAxis.tickFormat()(discretebar.x()(e.point, e.pointIndex)),
         y = yAxis.tickFormat()(discretebar.y()(e.point, e.pointIndex)),

+ 1 - 1
desktop/core/src/desktop/static/desktop/js/nv.d3.js

@@ -1248,7 +1248,7 @@ nv.utils.optionsFunc = function(args) {
                 .attr('text-anchor', 'end')
                 .text(function(d,i) {
                   var v = fmt(d);
-                  return ('' + v).match('NaN') ? '' : v;
+                  return ('' + v).match('NaN') ? '' : v.substr(0, 8);
                 });
             axisMaxMin.transition()
                 .attr('transform', function(d,i) {

+ 1 - 1
desktop/core/src/desktop/static/desktop/js/nv.d3.multiBarWithBrushChart.js

@@ -94,7 +94,7 @@ nv.models.multiBarWithBrushChart = function() {
   //------------------------------------------------------------
 
   var showTooltip = function(e, offsetElement) {
-    var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+    var left = e.clientX,
         top = e.pos[1] + ( offsetElement.offsetTop || 0),
         x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
         y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),