on 02-20-2009 1:45 PM
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.