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?