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:
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 = new ArrayList<Number>(){{ add(10000); add(20000); add(30000); add(50000); add(70000); }}; MeterGaugeChartModel model = new MeterGaugeChartModel(52200, intervals, ticks);
MeterGaugeChartModel
is a container class for value
, intervals
, and ticks
that control the gauge appearance.
There's more...
The title...