O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating interactive charts using the ItemSelect AJAX event

All of the PrimeFaces chart components support the itemSelect AJAX event which gets triggered when a series of charts are clicked on. The itemSelect event listener method receives an org.primefaces.event.ItemSelectEvent instance from which we can obtain an item index and a series index.

<p:growl id="growl" showDetail="true"/>

<p:pieChart value="#{chartController.pieChartModel}"
  style="width: 350px; height: 250px;"
  showDataLabels="true" legendPosition="ne">
  <p:ajax event="itemSelect" listener="#{chartController.itemSelect}" update="growl"/> </p:pieChart> public void itemSelect(ItemSelectEvent event) { FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Item selected", "Item ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required