cancel
Showing results for 
Search instead for 
Did you mean: 

SAPui5 sap.viz.ui5.StackedColumn custom tooltip on data point

Former Member
0 Kudos

Hi,

I am trying to implement a custom tooltip in a sap viz stacked column chart. This is the small popup window that appears when the mouse hovers a datapoint. My problem is how to detect the position of the data point so that the tooltip popup points to it. Currently it always points to the graph itself, not the datapoint inside the graph. Here's what I have:


graph = new sap.viz.ui5.StackedColumn({
  width
: graphWidth,
  height
: graphHeight,
  
//.. more properties here
  interaction
: new sap.viz.ui5.types.controller.Interaction({
  decorations
: [{name: "showDetail", fn: showDetailHandler}, {name: "hideDetail", fn:hideDetailHandler}]
  
}),

and the showDetailHandler is currently like this. It is supposed to display a popup pointing to the data point.


var showDetailHandler = function(oEvent){
  
var data = oEvent.data;
  
var offset = '0 0';
  
var tp3 = new sap.ui.ux3.ToolPopup({
  content
: [ new sap.ui.commons.Button({
  text
: "button"
  
}) ],
  
});
  offset
= '0 0';
  offset
= oEvent.position.x + " " + oEvent.position.y;
  tp3
.setPosition(  sap.ui.core.Popup.Dock.CenterBottom,
       sap
.ui.core.Popup.Dock.CenterTop,
       $
(oEvent.container),
        offset
,
       
"none");
  
if (tp3.isOpen()) {
     tp3
.close();
  
} else {
     tp3
.open(sap.ui.core.Popup.Dock.CenterBottom, sap.ui.core.Popup.Dock.CenterTop);
  
}
  
};

The docs around this are here:

https://sapui5.hana.ondemand.com/sdk/#docs/api/symbols/sap.ui.core.Popup.html#setPosition

https://sapui5.hana.ondemand.com/sdk/docs/api/symbols/sap.viz.ui5.types.controller.Interaction.html#...

My understanding is that the offset is an offset to the point calculated by the anchor point. Problem is, offset is completely ignored. Popup always appears at the top of the graph.

However, the normal tooltip appears in the correct place.

Any idea/example?

Thank you in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

have you found a solution by now?

I ran into the same problem.

Thank you very much!

Former Member
0 Kudos

Hi,

Sorry, no I did not find a solution for this problem. This chart's requirements changed midway and this problem solved by itself.

Kind regards,


Answers (1)

Answers (1)

aswani_sanjay
Explorer
0 Kudos

This message was moderated.