Solution: ADF Faces, How to programmatically build a dvt:pieGraph with List of elements.

While looking for a programmatic approach to generating a dvt:pieGraph, I noticed the collection data is slightly different compared to rendering a dvt:barGraph. After a quick search on the OTN Forum returned a thread but it looks like it was never answered entirely.

See the example solution below:

Within the backing bean:

public List<Object[]> getListObject() {
if (listObject == null) {
listObject = new ArrayList<Object[]>();
Object[] obj1 = { "Example_Bar_1", "Series_1", 10 };
Object[] obj2 = { "Example_Bar_1", "Series_2", 15 };
Object[] obj3 = { "Example_Bar_1", "Series_3", 75 };


return listObject;

JSF code:

<dvt:pieGraph id="graph2" subType="PIE" tabularData="#{YOURBEAN.listObject}">
<dvt:pieLabel rendered="true"/>
<dvt:legendArea automaticPlacement="AP_NEVER"/>

Runtime render:


About wesfang
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s