Chart - Interactive

Charts are interactive components, information about selected series and items can be passed via ajax to a JSF backing bean using ItemSelectEvent.

Source

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

    <h:panelGrid columns="2" columnClasses="left,right" style="width:100%">
        <p:chart type="pie" model="#{chartBean.pieModel1}" style="width:400px;height:300px">
            <p:ajax event="itemSelect" listener="#{chartBean.itemSelect}" update="growl" />
        </p:chart>

        <p:chart type="bar" model="#{chartBean.barModel}" style="width:400px;height:300px">
            <p:ajax event="itemSelect" listener="#{chartBean.itemSelect}" update="growl" />
        </p:chart>  
    </h:panelGrid>

</h:form>