Creating a 3D BarChart using JFreeChart

The given code snippet can create a 3D Bar Chart. The given Bar Chart compares 2 aspects of each customer. The generated chart will have two bars for each customer for both Profit1 and Profit 2 (see the dataset).

Profit 1 can can be total annual profit and Profit 2 can be profit for a particular period like monthly or weekly profit. Please find the sample image created using this code.

DefaultCategoryDataset dataset = new DefaultCategoryDataset(); 
dataset.setValue(6, "Profit1", "Jane"); 
dataset.setValue(3, "Profit2", "Jane"); 
dataset.setValue(7, "Profit1", "Tom"); 
dataset.setValue(10, "Profit2", "Tom"); 
dataset.setValue(8, "Profit1", "Jill"); 
dataset.setValue(8, "Profit2", "Jill"); 
dataset.setValue(5, "Profit1", "John"); 
dataset.setValue(6, "Profit2", "John"); 
dataset.setValue(12, "Profit1", "Fred"); 
dataset.setValue(5, "Profit2", "Fred");
// Profit1, Profit2 represent the row keys 
// Jane, Tom, Jill, etc. represent the column keys
JFreeChart chart = ChartFactory.createBarChart3D( 
   "Comparison between Salesman",  // Chart name 
   "Salesman",                     // X axis label 
   "Value ($)",                    // Y axis value 
   dataset,                        // data set 
   true, true, false);
// Creating a JPEG image 
   ChartUtilities.saveChartAsJPEG(new File("myChart.jpg"), chart, 500, 300); 
catch (IOException e) 
   System.err.println("Problem occurred creating chart."); 

Image generated:

3d BarChart Generated using JFreeChart

Other useful links:
Creating Time Series charts using JFreeChart
Creating Pie Chart using JFreeChart (Using plot)
Creating Pie Chart using JFreeChart