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 donut (doughnut) chart

The donutChart component renders a multiseries of pie charts, like a combination, in one plotting.

How to do it...

A simple definition for a donut(doughnut) chart to display stock exchange options as three circles would be as follows:

<p:donutChart value="#{donutChartController.model}" style="height:250px" title="Stocks by Year"  />

This output will be rendered as follows:

How to do it...

The model that binds to the component should be an instance of org.primefaces.model.chart.DonutChartModel.

DonutChartModel model = new DonutChartModel(); Map<String, Number> circle1 = new LinkedHashMap<String, Number>(); circle1.put("APPL", 150); circle1.put("IBM", ...

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