Opened 8 years ago

Closed 7 years ago

#12408 closed defect (fixed)

Problem with chart's tooltip

Reported by: kiuma Owned by: Eugene Lazutkin
Priority: high Milestone: 1.7.2
Component: Charting Version: 1.6.0rc1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Eugene Lazutkin)

After a zoom on a chart, the tooltip is displayed outside the chart (on bars and columns). I've fixed the problem modifying dojox/charting/action2d/Tooltip.js at the end of process function place this code:

var lt = dojo.coords(this.chart.node, true);

var chartRect = {
  x: o.chart.offsets.l,
  y: o.chart.offsets.t,
  width: o.chart.plotArea.width,// - o.chart.offsets.l,// - o.chart.offsets.r,
  height: o.chart.plotArea.height// - o.chart.offsets.t// - o.chart.offsets.b
};

aroundRect.x += lt.x;
aroundRect.y += lt.y;
aroundRect.x = Math.round(Math.max(aroundRect.x, chartRect.x));
aroundRect.y = Math.round(Math.max(aroundRect.y, chartRect.y));
aroundRect.width = Math.ceil(Math.min(aroundRect.width, chartRect.width));
aroundRect.height = Math.ceil(Math.min(aroundRect.height, chartRect.height));
this.aroundRect = aroundRect;

var tooltip = this.text(o);
if(tooltip){
  dijit.showTooltip(tooltip, this.aroundRect, position);
}

instead of the previous:

var lt = dojo.coords(this.chart.node, true);
aroundRect.x += lt.x;
aroundRect.y += lt.y;
aroundRect.x = Math.round(aroundRect.x);
aroundRect.y = Math.round(aroundRect.y);
aroundRect.width = Math.ceil(aroundRect.width);
aroundRect.height = Math.ceil(aroundRect.height);
this.aroundRect = aroundRect;

var tooltip = this.text(o);
if(tooltip){
  dijit.showTooltip(tooltip, this.aroundRect, position);
}

Change History (5)

comment:1 in reply to:  description Changed 8 years ago by kiuma

sorry I had formatting problems the code is:

var lt = dojo.coords(this.chart.node, true);

            var chartRect = {
                x: o.chart.offsets.l,
                y: o.chart.offsets.t,
                width: o.chart.plotArea.width,
                height: o.chart.plotArea.height
            };

			aroundRect.x += lt.x;
			aroundRect.y += lt.y;
			aroundRect.x = Math.round(Math.max(aroundRect.x, chartRect.x));
			aroundRect.y = Math.round(Math.max(aroundRect.y, chartRect.y));
			aroundRect.width = Math.ceil(Math.min(aroundRect.width, chartRect.width));
			aroundRect.height = Math.ceil(Math.min(aroundRect.height, chartRect.height));
			this.aroundRect = aroundRect;

			var tooltip = this.text(o);
			if(tooltip){
                dijit.showTooltip(tooltip, this.aroundRect, position);
			}

comment:2 Changed 8 years ago by Eugene Lazutkin

Component: DojoX GridCharting
Description: modified (diff)
Milestone: tbdfuture
Owner: changed from bryanforbes to Eugene Lazutkin
Priority: highnormal
severity: blockernormal
Status: newassigned

comment:3 Changed 7 years ago by Tom Trenka

Actually ran into the same problem (using bars), and my fix is a little simpler. In the case "bar" statement, around line 93:

case "bar":
    aroundRect = lang.clone(o.shape.getShape());
    aroundRect.w = aroundRect.width;
    aroundRect.h = aroundRect.height;
    break;

It looks to me like the problem is that dijit.Tooltip is looking for w/h as opposed to width/height.

comment:4 Changed 7 years ago by cjolif

Milestone: future1.7.2

This was fixed using ttrenka suggestion, so let's close this.

comment:5 Changed 7 years ago by cjolif

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.