Java (Jfreechart) Implementation of a variety of data statistics (column chart, pie chart, line chart) "Original address: http://blog.csdn.net/pzhtpf/article/details/7600100"
Recently in the course of data mining design, need to analyze the results of the data is very intuitive to the user, this will need to use the data map, to achieve this function requires a few Third-party packages:
1. Jfreechart-1.0.13.jar
2. Jcommon-1.0.16.jar
3. Gnujaxp.jar
Let's take a look at the final effect chart:
Mainly Jfreechart-1.0.13.jar, but these three packages to complete, I have all the jfreechart -related jar package with the example of the project (code) compressed together upload, interested students can download,
Download Address: http://download.csdn.net/detail/pzhtpf/4327700
Next, we step into the implementation of this program.
First, the preparatory work, also put these three third-party packages into the project, add the process is particularly simple, the previous blog, is about how to read the data in the Excel table (interested students can take a look at: http://blog.csdn.net/pzhtpf/ article/details/7506135), but also to add a third party package, add the same process, here we are reviewing:
1, build a Java project in this project in the establishment of a new folder Lib;
2, copy the above three jar packages to Lib
3, then right click on this Java project, select Properties
4, select Java build Path in the left list and select libraries on the right
5, click Add JARs
6, then to select the three jars in the Lib folder in this project, click OK
After success, there will be one more folder in the project: referenced libraries
two, to implement the column chart Java code: [Plain] View plain copy import java.awt.Font; import org.jfree.chart.chartfactory; import org.jfree.chart.chartpanel; import org.jfree.chart.jfreechart; import org.jfree.chart.axis.categoryaxis; import org.jfree.chart.axis.valueaxis; import org.jfree.chart.plot.categoryplot; Import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.category.categorydataset; import org.jfree.data.category.defaultcategorydataset; public class barchart { ChartPanel frame1; public barchart () { Categorydataset dataset = getdataset (); jfreechart chart =  Chartfactory.createbarchart3d ( " Fruit ", // Chart title "Fruit type", / / the display label of the catalog axis