O'Reilly logo

PrimeFaces Cookbook by Mert Çalışkan, Oleg Varaksin

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 a bar chart

The barChart component visualizes the series of point data as bars in a graph.

How to do it...

A simple definition for a bar chart to display two series of data is shown in the following code snippet:

<p:barChart value="#{barChartController.model}" style="height:250px" title="Company Performance" />

The chart will be rendered as shown in the following screenshot:

How to do it...

The model that binds to the component should be an instance of the org.primefaces.model.chart.CartesianChartModel class. The definition of data with two sample series is shown in the following code snippet:

CartesianChartModel model = new CartesianChartModel(); ChartSeries ...

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