Creating a Line chart
A Line chart represents a series of data points in a line graph. The Line chart data model should be an instance of org.primefaces.model.chart.CartesianChartModel
.
Let us see how to visualize a number of posts for various tags in each year using the Line chart.
<p:lineChart value="#{chartController.chartModel}" legendPosition="se"/>
The chartModel
can be created and initialized as follows:
public ChartController() { CartesianChartModel chartModel = new CartesianChartModel(); ChartSeries primefacesSeries = new ChartSeries(); primefacesSeries.setLabel("PrimeFaces"); primefacesSeries.set("2009", 150); primefacesSeries.set("2010", 250); primefacesSeries.set("2011", 300); primefacesSeries.set("2012", 240); primefacesSeries.set("2013", 400); ChartSeries jquerySeries = new ChartSeries(); querySeries.setLabel("jQuery"); jquerySeries.set("2009", 210...