cancel
Showing results for 
Search instead for 
Did you mean: 

Showing Percentages and Value in Pie Chart

Former Member
0 Kudos

Hi,

Can anybody tell me how to show both percentages and value in Pie Chart using Business Graphics?

Regards,

Suresh.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hi Suresh,

Would you like to have let`s say for category1 - the percentages and for category2 - the value? Or would you like to have for all categories "percentages% (value)" label?

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi Maksim,

I would like to show both value and percentages in the pie chart as label.

Regards,

Suresh.

former_member182372
Active Contributor
0 Kudos

Hi Suresh,

Well it is not one-click deal actually.

Let`s assume that we have following context ctructure:

DataSource (cardinality 0..n, selection 0..1)

+CategoryID

+CategoryName

+SeriesValue1

UI layout:

We have business graphic with type "pie" ("seriesSource" bound to "DataSource"). We have "Category1" as category under business graphic ("description" bound to "DataSource.CategoryName") and "Series1" as series ("pointSource" biund to "DataSource") and "Series1_Point" as point under series (<b>customizingID bound to "DataSource.CategoryID"</b> !VERY IMPORTANT!, "valueSource" to "DataSource") and NumericValue1 as value under point (type is "y", value bound to "DataSource.SeriesValue1").

View controller:

Method wdDoInit (to initialize DataSource):

[code]IPrivateSimpleGraphicsView.ICategoriesNode catsnode = wdContext.nodeCategories();

for (int aIndex = 0; aIndex <= 5; ++aIndex) {

IPrivateSimpleGraphicsView.ICategoriesElement catelem = catsnode.createCategoriesElement();

catelem.setCategoryText("SOME_TEXT");

catelem.setCategoryID("Point" + aIndex);

catelem.setSeries1Value(aIndex);

catsnode.addElement(catelem);

}[/code]

Method wdDoModifyView (to build customization):

[code]

if(firstTime) {

final IWDBusinessGraphics bg = (IWDBusinessGraphics)view.getElement("BusinessGraphic");

StringBuffer sb = new StringBuffer();

sb.append("<SAPChartCustomizing version=\"1.1\">");

sb.append("<Values>");

for (int aIndex = 0; aIndex <= 5; ++aIndex) {

sb.append("<Point id=\"Point").append(aIndex).append("\">");

sb.append(" <ShowLabel>true</ShowLabel>");

sb.append(" <Format>$Percent0.00 &quot;% (&quot;0.00&quot;)&quot;</Format>");

sb.append("</Point>");

}

sb.append("</Values>");

sb.append("</SAPChartCustomizing>");

bg.setDirectCustomizing(sb.toString());

}

[/code]

And that`s it!

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Thanks Maskim. 10 points awarded.

Regards,

Suresh.

udaykumar_kanike
Active Contributor
0 Kudos

Hi Maksim,

How can I display just count (Value) on each series of a column chart? Can I use your mentioned code or are there any minor changes i need to make in the code. Please suggest me.

Thanks

Uday

Answers (0)