Java implementation of a variety of data statistics (column chart, pie chart, line chart)

Source: Internet
Author: User

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 =&nbsp Chartfactory.createbarchart3d (                                  " Fruit ", //  Chart title                                  "Fruit type",  / /  the display label of the catalog axis                       

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.