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:
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", 180); circle1.put("AMD", 30); circle1.put("INTC", 120); model.addCircle(circle1); Map<String, Number> circle2 = new LinkedHashMap<String, Number>(); circle2.put("APPL", 180); circle2.put("IBM", 90); circle2.put("AMD", 100); circle2.put("INTC", 80); model.addCircle(circle2); Map<String, Number>...