dvt:barGraph should have the clickListener
< dvt:barGraph id="Graph1"
value="#{bindings.View1.graphModel}"
subType="BAR_VERT_CLUST"
clickListener="#{MyBeab.clickAction}" ...>
In bean the clickListener should be implemented as follows:
void processClick(ClickEvent event)
{
ComponentHandle handle = event.getComponentHandle();
if (handle instanceof DataComponentHandle)
{
DataComponentHandle dhandle = (DataComponentHandle)handle;
// Get the value displayed in the series
System.out.println("Value: " + dhandle.getValue(DataComponentHandle.UNFORMATTED_VALUE));
// Get the series attributes
Attributes [] seriesInfo = dhandle.getSeriesAttributes();
if(seriesInfo != null)
{
for(Attributes attrs: seriesInfo)
{
System.out.println("Series value: " + attrs.getValue(Attributes.LABEL_VALUE));
System.out.println("Series name: " + attrs.getValue(Attributes.LABEL_ATTRIBUTE));
System.out.println("Series value id: " + attrs.getValue(Attributes.ID_VALUE));
System.out.println("Series name id: " + attrs.getValue(Attributes.ID_ATTRIBUTE));
}
}
// Get the group attributes
Attributes [] groupInfo = dhandle.getGroupAttributes();
if(groupInfo != null)
{
for(Attributes attrs: groupInfo)
{
System.out.println("Group value: " + attrs.getValue(Attributes.LABEL_VALUE));
System.out.println("Group name: " + attrs.getValue(Attributes.LABEL_ATTRIBUTE));
}
}
}
}
No comments:
Post a Comment