cancel
Showing results for 
Search instead for 
Did you mean: 

many dynamic series in BusinessGraphics

Former Member
0 Kudos

Hi all:

I got a List form RFC. I want to show in a pie chart.

I can't sure the List size.

My idea is dynamic add attribute, and create element.

But it does't work.

my code is like this


List list = wdContext.currentZmtk_Hr_Demo_InputElement().modelObject().getOutput().getIt_Depart();

int a = list.size();

IWDNodeInfo rootNodeInfo = wdContext.getNodeInfo();
IWDNodeInfo categoryNodeInfo = rootNodeInfo.getChild("category");

for (int i = 0; i < list.size(); i++) {

	categoryNodeInfo.addAttribute("seriesValue"+(i+1), "ddic:com.sap.dictionary.double");
	Zmtk_Hr_01 z = (Zmtk_Hr_01) list.get(i);
	String category = z.getDepart();
	short number = z.getNumber();
	ICategoryElement ele = wdContext.createCategoryElement();
	wdContext.nodeCategory().addElement(ele);
	ele.setCategorytext(category);
	ele.setAttributeValue("seriesValue"+(i+1),(double) number+"");
	//ele.setSeriesValue((double) number);
}

I know this is wrong.

Could anyone show me what to do?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Allen,

1. Have you executed RFC as follows:

wdContext.currentZmtk_Hr_Demo_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

Because only after execute you will get output in to your modal node.

2. I have not worked in dynamic programming much but i believe that code

categoryNodeInfo.addAttribute("seriesValue", "ddic:com.sap.dictionary.double");

must be before for loop. And for setting data into this attribute inside for loop code will be

ele.setAttributeValue("seriesValue",(double) number+"");

Regards,

Gopal

Former Member
0 Kudos

Thanks Gopal .

I finally solved this problem.

I was misunderstanding the meaning of "series".

Anyway I solved this, Thanks.

Now I got another question.

I want to show a pie chart, and hope the labels could be shown not olny on the buttom, but also on the side of pie.

I opend chart desingner, and in the attributes tree I found an element named "Series".

I checked the "show labels" in the "Default Series".

The preview shown left is what I want.

But when I deployed, the result on the web page didn't show as that preview.

Does anybody know how to fix this?

tks.

kai_gutenkunst
Active Contributor
0 Kudos

If the preview (Chart Designer) differs from the image at runtime (IGS) this sounds like using an outdated version, either of the local sapchart.ocx or of the IGS.

Regards, Kai