cancel
Showing results for 
Search instead for 
Did you mean: 

Business Graphic onAction

Former Member
0 Kudos

Hi Exports,

I have requirement where i need to implement the Business Graphics on Action Method and Display the Data Relevent to the Series / Category.

I have tried implementing on action method it is working fine ,but i am not able to get the Selected Series/Category Element

Please help me if someone already did this

Thanks & Regards,

Pavan Kumar Marla

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Pavan,

Which type of series are you using(Simple Series Or Series). If Simpleseries is used then this is not possible. But with Series there is a workaround to get the selected series point's value.

If you have not done the parameter mapping, add a parameter id of type String to the onAction method. Then Right-click on BusinessGraph UI in the "Outline" view and select "Parameter Mapping". In the dialog that opens, you can use drag-and-drop to map event parameters to action parameters.

Create an attribute Va_PointIndex of type String under the subnode for Point, and bind it to the eventId property of the series_point. Populate this attribute with the series element and point element index and using this event id extract the corresponding element as shown in the below example.

Assuming Va_PointIndex is populated as follows,


elPointElement.setVa_PointIndex(<SeriesIndex>+"s"+<pointIndex>);

add the below mentioned code in the onAction method


int seriesIndex =Integer.parseInt(id.substring(id.lastIndexOf(":")+1,id.lastIndexOf("s")));
int pointIndex = Integer.parseInt(id.substring(id.lastIndexOf("s")+1));

IPrivate<ViewName>.ISeriesElement element = wdContext.nodeSeries().getSeriesElementAt(seriesIndex);
IPrivate<ViewName>.IPointElement elPointElement = element.getPointElementAt(pointIndex);
int selectedValue = elPointElement.get<Attributename>(); // The attribute bound to the NumericValue added under Point.

IPrivate<ViewName>.ICategoryElement elCategoryElement = wdContext.nodeCategory().getCategoryElementAt(pointIndex);
String category = elCategoryElement.getCategoryName();

If you have any queries, revert back.

Regards,

Vishweshwara P.K.M.

Former Member
0 Kudos

Hi Vishweswara,

I have used simple series UI Element

Can You please give me any example or related links,for using the Series UI element

Thanks & Regards,

Pavan Kumar Marla

Edited by: pavanmarla on Nov 10, 2011 3:36 AM

Former Member
0 Kudos

Hi Pavan,

Under the Business Graph UI add the Category as usual, add a single Series. Under the Series add a Point and for the Point add a Value of type NumericValue.

Create a Node for Category Say Vn_Category and an Attribute Under it say Va_CategoryName and bind Description property of Category to Vn_Category-->Va_CategoryName .

Create another node structure as shown below for Series,

Vn_Series

--Vn_Point(Child Node)

-


Va_Value(Type Int)

-


Va_PointIndex(Type String)

-


Va_ToolTip(Type String)

Set the Singleton property of Vn_Point node as false.

The PointSource property of Series to be bound to Vn_Series-->Vn_Point.

The ValueSource property of Point to be bound to Vn_Series>Vn_Point, Tooltip to Vn_Series>Vn_Point>Va_ToolTip and eventid property to Vn_Series>Vn_Point-->Va_PointIndex.

The Value property of NumericValue to Vn_Series>Vn_Point>Va_Value, and make sure Type is defined as "Y".

Create so many series(parent node) elements as many series you need in the graph and using each series(parent node) element create so many point(Child node) elements as many bars or as many categories are there in the graph.

Example:


//Creating 4 Series
IPrivateKpiChartView.IVn_SeriesElement elSeriesElement1 = null;
IPrivateKpiChartView.IVn_SeriesElement elSeriesElement2 = null;
IPrivateKpiChartView.IVn_SeriesElement elSeriesElement3 = null;
IPrivateKpiChartView.IVn_SeriesElement elSeriesElement4 = null;
elSeriesElement1 = wdContext.nodeVn_Series().createAndAddVn_SeriesElement();
elSeriesElement2 = wdContext.nodeVn_Series().createAndAddVn_SeriesElement();
elSeriesElement3 = wdContext.nodeVn_Series().createAndAddVn_SeriesElement();
elSeriesElement4 = wdContext.nodeVn_Series().createAndAddVn_SeriesElement();

//Populating 5 Categories and corresponding values,
IPrivateKpiChartView.IVn_CategoryElement elCategoryElement = null;
IPrivateKpiChartView.IVn_PointElement elPointElement1 = null;
IPrivateKpiChartView.IVn_PointElement elPointElement2 = null;
IPrivateKpiChartView.IVn_PointElement elPointElement3 = null;
IPrivateKpiChartView.IVn_PointElement elPointElement4 = null;
for (int index = 0; index < 5; index++) {
elCategoryElement = wdContext.nodeVn_Category().createAndAddVn_CategoryElement();
elCategoryElement.setVa_CategoryName("Category"+index);
		
elPointElement1 = elSeriesElement1.nodeVn_Point().createAndAddVn_PointElement();
elPointElement1.setVa_PointIndex("0s"+index);
elPointElement1.setVa_Value(index+1); //The value to be displayed on the graph.
elPointElement1.setVa_ToolTip("Series 1");
		
elPointElement2 = elSeriesElement2.nodeVn_Point().createAndAddVn_PointElement();
elPointElement2.setVa_PointIndex("1s"+index);
elPointElement1.setVa_Value(index+2);
elPointElement2.setVa_ToolTip("Series 2");
		
elPointElement3 = elSeriesElement3.nodeVn_Point().createAndAddVn_PointElement();
elPointElement3.setVa_PointIndex("2s"+index);
elPointElement1.setVa_Value(index+3);
elPointElement3.setVa_ToolTip("Series 3");
		
elPointElement4 = elSeriesElement4.nodeVn_Point().createAndAddVn_PointElement();
elPointElement4.setVa_PointIndex("3s"+index);
elPointElement1.setVa_Value(index+4);
elPointElement4.setVa_ToolTip("Series 4");
}

Using the snippet in my previous replay, u can extract the selected series point's value and the corresponding category.

Also you can refer the wiki link [WIKI|http://wiki.sdn.sap.com/wiki/display/WDJava/WebDynproDynamicBusiness+Graphics]

Regards,

Vishweshwara P.K.M.

Edited by: Vishweshwara P.K.M on Nov 16, 2011 4:28 PM

Answers (0)