Thursday, April 11, 2013

JSF 2.x Tip of the Day: RichFaces 4.3.x Charts in JSF using JSFlot, JFreeCharts, and PrimeFaces

Sexy PrimeFaces Charts in RichFaces

Introduction

I was asked to look at various charting solutions for JSF. Specifically, I was asked for some choices for use with RichFaces 4.3.1. I knew that PrimeFaces has really good chart components already so I knew it might be kind of fun to integrate them if possible. I was also aware of JFreeChart which will work, but produces some... rather ugly charts. Finally, someone had suggested that I look at jsflot. This was a very promising solution. This project is a proof of concept which demonstrates integration between projects, and technologies.

Requirements

  • jsflot
  • NetBeans This is required for the sample database, although you could create your own data.
The jsflot framework is currently not Mavenized, so if you are going to run my example code, you will need to download it from the link above, and install it in Maven using the command below.

Code

The code for this NetBeans Maven project can be found on BitBucket here: chart-demo

This is the bean that provides the data models for the charting solutions. There are a number of chart demos in the project. The two charts above are just examples.

ChartBean.java

0 comments :

Popular Posts