cancel
Showing results for 
Search instead for 
Did you mean: 

Struggling with BusinessGraphics

Former Member
0 Kudos

I can create simple bar and pie charts, but there is a chart that I just can't seem to get rendered properly.

The data would look something like this:


Context
    |
    ---- Region
            |
            ---- Location
            |          |
            |           ---- Details
            |          |         |
            |          |         ---- Date
            |          |         |
            |          |         ---- Time
            |          |
            |          ---- Name
            |          |
            |          ---- Value
            | 
            ---- Name
            |
            ---- Value

So I have 1..n Regions, each containing 1..n Locations and each with 1..n Details. We can ignore the details for now as they are not part of the chart, but some additional data that is displayed when the chart is clicked...

I want to present a chart something like this:


6.0  |                                            |                                   |
     |       -------------                        |                    -----------    |
5.0  |      |             |-------------          |        -----------|           |   |
     |      |             |             |         |        |          |           |   |
4.0  |      |             |             |         |        |          |           |   |
     |      |             |             |         |        |          |           |   |
3.0  |      |             |             |         |        |          |           |   |
     |      |             |             |         |        |          |           |   |
2.0  |      |             |             |         |        |          |           |   |
     |      |             |             |         |        |          |           |   |
1.0  |      |             |             |         |        |          |           |   |
     |      |             |             |         |        |          |           |   |
0.0  |      |             |             |         |        |          |           |   |
      --------------------------------------------------------------------------------
                       Region 1                          Region 2

Where region 1 would have two location nodes in it, one with a name of Centerville and value of 5.5, the other with name of Leftville and a value of 5.0. Region would have two nodes, one with name Rightsville and a value of 5 and one with name Midtown and a value of 5.5.

The problem I am having is that I can't render a chart where bar1 of category 1 and bar 1 of category 2 don't represent the same name. If I had a Centerville in both region 1 and region 2, all is good. But that is not the case here.

Any ideas?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member185086
Active Contributor
0 Kudos

Hi

Take some help form [this|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/7802] [original link is broken] [original link is broken] [original link is broken];. meanwhile I am working to sort out this problem

Best Regards

Satish Kumar

Former Member
0 Kudos

What an excellent link. I will be studying that today!

Thanks for your assistance.I have several of these reports to make, but most of the ones I can't figure out are of a similar format.

Thanks again.

Former Member
0 Kudos

FYI, I was unable to import the BusinessGraphicsDemo application. I got a bunch of errors.

Former Member
0 Kudos

So far every example of BusinessGraphics I have found utilizes the SimpleSeries and NOT the Series element. One item I found [Using The Internet Graphics Server in Web Dynpro|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/50c7a90f-21a3-2910-87b5-e1f0e39462ae] was even so definitive as to say on page 9:

Each series UI element must be of type SimpleSeries....

So I have been restructuring my data nodes and UIs to incorporate this. What I now have is a properly rendered graph, but I am not able to properly map actions to determine effectively what was clicked on. As the event ID and label attributes of SimpleSeries are not bindable, all rendered instances share the SAME event ID and label. I will try to describe my setup to better explain my problem...

My very simplistic context node that supplies the data looks like this:


Context
     |
     --- Data
          |
          --- RelatedReports
          |        |
          |        ---- Id
          |        |
          |        ---- Name
          |        |
          |        ---- Type
          |
          --- Category
          |
          --- Label1
          |
          --- Label2
          |
          --- Value1
          |
          --- Value2

I have stored in this two elements with the corresponding values:

Category: Europe

Label1: Near Miss

Value1: 100

Label2: Occurrence

Value2: 50

Category: United States

Label1: Near Miss

Value1: 75

Label2: Occurrence

Value2: 48

Each of these two elements also has a series of "RelatedReports" elements in it's non-singleton node (which does not affect the graph but is relevant later)

To render this as a column graph, I have included a BusinessGraphics (id BG) element in my UI. The seriesData attribute is set to the Data node. The onAction is set to my action "ColumnSelected". I have also included the following code:


public static void wdDoModifyView(IPrivateOFIsView wdThis, 
  IPrivateOFIsView.IContextNode wdContext, 
  com.sap.tc.webdynpro.progmodel.api.IWDView view, 
  boolean firstTime) 
{
   if (firstTime) {
      IWDBusinessGraphics chart= (IWDBusinessGraphics) view.getElement("BG");
      chart.mappingOfOnAction().addSourceMapping(IWDBusinessGraphics.IWDOnAction.ID, "id");
   }
}
....
public void onActionColumnSelected(
    com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, 
    java.lang.String id )
{
    //@@begin onActionColumnSelected(ServerEvent)
    wdComponentAPI.getMessageManager().reportSuccess(id);
    //@@end onActionColumnSelected(ServerEvent)
}

The BusinessGraphics has one Category element and two SimpleSeries:

Category

description: Data.Category

eventID: Data.Category

id: Category

tooltip: Data.Category

SimpleSeries1

customizingID:

eventID: Near Miss

id: SimpleSeries1

label: Near Miss

tooltip: Near Miss

value: Data.Value1

SimpleSeries2

customizingID:

eventID: Near Miss

id: SimpleSeries2

label: Near Miss

tooltip: Near Miss

value: Data.Value2

As we know the eventID, id, label and tooltip values of SimpleSeries are not bindable. Which brings me to my first issue, I wish I could bind the tooltip to the Value and not the Label. Oh well...

So all of this does properly render my graph. My issue now comes in when the user clicks on any of the columns. What I get is the eventID (as expected) of either "Near Miss" or "Occurrence". But there is no way for me to determine for which Category ("Europe" or "United States") they wanted to see this data.

If they click the "Near Miss" column under the "Europe" Category, all I get is Near Miss. No way to determine if they wanted the one in Europe or United States.

The end goal here is to have the user click on a column (i.e. the Near Miss column in the Europe category), be able to determine that element with Category "Europe" was clicked on AND that the event type "Near Miss" was clicked on. With that information I would then display the related reports for that selected element in a table somewhere.

If anyone has any inside information on what I can do or what I'm doing wrong, that would be excellent. If anyone needs additional information I would be glad to provide that as well.

Many thanks.

sanyev
Active Participant
0 Kudos

Hi Tom,

I did a similar project some time back in my previous company. Since Business Graphics only shows data there is no need to directly bind model data. What I did in my case was I created Value nodes in the context for categories, series and series points. The nodes also contained the event ID attribute.

In the wdDoInit method I populated the context I created with data from the backend. While creating the data I created the corresponding eventID string. Basically the event ID was a delimited string which contained all the required information which was used later in the event handler.

After the data was created in the context based on the data I created the UI elements. The entire UI was created at runtime. The eventID which I created during datapopulation was set to the corresponding UI Element.

At runtime when the user clicks on the graph the event id that was passed to the event handler contained all the information that i neeeded. You could also create such an event ID for you requrement. something like category:Europe:NearMiss

Do let me know if you need more info.

Regards,

Sanyev