cancel
Showing results for 
Search instead for 
Did you mean: 

Refreshing a bar chart

Former Member
0 Kudos

I have an application in which I'm retrieving data using a BAPI and displaying it in a table. I'm using two of the returned fields to display a stacked bar chart using a BusinessGraphics UI element. When the table loads initially the graph displays the values in the first row correctly. However, when I select other rows in the table the graph doesn't update.

I would really appreciate it if anyone can tell me how to get the graph to update when the row selection changes.

Thanks in advance,

Ross

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member751941
Active Contributor
0 Kudos

Hi Ross,

Go to the Table property and crate a “onLeadSelect” Event Action(say populateGraph).

public void onActionpopulateGraph(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

int n = wdContext.nodeTable().size();

int leadSelected = wdContext. nodeTable().getLeadSelection();

for (int i = 0; i < n; i++) {

if (leadSelected == i) {

<b> Write the logic here to show the graph.</b>

}

}

}

Regards,

Mithu

Former Member
0 Kudos

Well, I've tried similar to that. I created a value node (graph) with two value attributes that represent the values for the graph (series1 and series2). I added two series to the BusinessGraphics element and bound them to the two attributes.

I then created an action and assigned to the onLeadSelect of the table. In the method I added this code:

wdContext.currentGraphElement()

.setSeries1(wdContext.currentModelElement().getSeatsAv()); wdContext.currentGraphElement()

.setSeries2(wdContext.currentModelElement().getSeatsOc());

SeatsAv and SeatsOc are bound to columns in the table.

I've used the message manager to print series1 and series2 so I know they are set to the correct values. However, the graph shows nothing.

If I bind the two series in the BusinessGraphics element to SeatsAv and SeatsOc then the graph shows the first row in the table when the table is filled but does not change when I change the lead selection. I'm baffled. Is there a way to force the graph to refresh itself.

Ross