cancel
Showing results for 
Search instead for 
Did you mean: 

BusinessGraphics and onAction mapping

Former Member
0 Kudos

I am trying to get a handle on Business Graphics and actions. I can succesfully generate a beautiful chart. But now what I want to do is when the user clicks on a section of the chart, I want to display the underlying data in a table. My problem is I can't seem to be able to determine which slice of the pie (or it's corresponding Context Element) was clicked on.

First I created an Action and mapped it to the BusinessGraphics element.


if (wdContext.currentDataElement() != null) {
    wdComponentAPI.getMessageManager().reportSuccess(wdContext.currentDataElement().getLabel());
}
else {
    wdComponentAPI.getMessageManager().reportWarning("No element selected.");
}

But it always returned No Element Selected, which means clicking on the graphic did NOT select the corresponding Context Element.

So I tried the following in my wdDoModify (like I would do with a recursive tree structure):


IWDBusinessGraphics bg = (IWDBusinessGraphics) view.getElement("BG");
bg.mappingOfOnAction().addParameter("nodeElement", "nodeElement");

And I then added a parameter nodeElement of type IDataElement to my action. Didn't work. I got an OutOfBoundsException.

Any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

From the Jacadoc I see that there exists a parameter "id" of the onAction event. Try to map it to some action parameter, either using the parameter mapping editor or by code like this


 if (firstTime)
 {
   IWDBusinessGraphics myBusinessGraphics = (IWDBusinessGraphics) view.getElement("ID-of-BusinessGraphics");
   myBusinessGraphics.mappingOfOnAction().addSourceMapping
   (
     IWDBusinessGraphics.IWDOnAction.ID, // event parameter name
     "name-of-action-parameter" // (type String)
   ); 
 }

Unfortunately, the Javadoc doen't tell what this parameter means (cool, isn't it?)

Armin

Former Member
0 Kudos

Yup, that was it. It returned the attribute value defined as the Category, which allowed me to curse through the node to find the related element. Excellent.

Many thanks.

Answers (0)