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 meter gauge chart

The meterGauge component visualizes data on a meter gauge display.

How to do it...

A simple definition for a meter gauge to list metric tons per year is shown as follows:

<p:meterGaugeChart id="simple" value="#{meterGaugeController.model}" style="height:250px" />

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 org.primefaces.model.chart.MeterGaugeChartModel. The definition for the model with the ticks and intervals is given as follows:

List<Number> intervals = new ArrayList<Number>(){{ add(22000); add(55000); add(70000); }}; List<Number> ticks ...

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