I’ve been coding dashboard applications lately with Java SE. I have used JFreeChart library to generate all pie, line and bar charts. The library is awesome and is also Open Source. It would be very nice to see similar projects in the .NET world.
It was very easy to create first charts with JFreeChart mostly because it is so commonly used so there are many resources available in the Internet including tutorials and tips&tricks.
Here is a small sample how to create a simple pie chart and use it in your Swing application:
// First create dataset
DefaultPieDataset dataset = new DefaultPieDataset();
// Create chart using the ChartFactory
JFreeChart chart = ChartFactory.createPieChart(
"the Nordic countries", // Title
dataset, // Dataset
false, // Don’t show legend
The following code adjusts chart appearance and section colors. This is not mandatory but shows how easily you can customize the visual parts of the chart.