Java learning notes-detailed explanation of jfreechart

Source: Internet
Author: User

Jfreechart is SourceForge
A Java open-source project is an excellent Java chart generation plug-in that provides,
Servlet and JSP generate charts of various image formats, including bar chart, pie chart, line chart, and Sequence Chart.

Jfreechart depends on another project: jcommon

Jfreechart projects are free of charge, but documents are charged.

L

The basic steps for generating a dynamic statistical chart using the jfreechart plug-in are as follows:

1. related attributes required for drawing preparation

2. Create a DataSet object

3. Create a jfreechart instance

4. Generate custom Images

Jfreechart core introduction:

Jfreechart: Chart object. This object is used to generate any type of chart. The jfreechart plug-in provides a factory class chartfactory to create various types of chart objects.

Xxxdataset: DataSet object. Used to save the data for drawing charts. Different types of charts correspond to different types of dataset objects.

Xxxplot: Drawing area object. If you need to customize the relevant drawing properties of the drawing area, you need to set it through this object.

Xxxaxis: coordinate axis object. Used to define the drawing properties of the coordinate axis.

Xxxrenderder: Specifies the image rendering object. Used to render and display charts.

Xxxurlgenerator: link object. Used to generate a mouse-click link for a project in a web chart

Xxxtooltipgenerator: The Chart prompt object. Generates chart prompts. Different types of charts correspond to different types of chart prompt objects.

Pie chart:

Jfreechart can be used to generate both a pie chart with common effects and a pie chart with 3D effects.

Pie Chart of Common effects:
Chartfactory. createpiechart ()

3D effect pie chart:
Chartfactory. createpiechart3d ()

Entry parameter types and functions of the pie chart Method

Parameter 1: String title-chart title

Parameter 2: piedataset dataset-drawing Dataset

Parameter 3: Boolean legend-used to set whether to display the legend

Parameter 4: Boolean tooltips-used to set whether a standard generator is used

Parameter 5: Boolean URLs-used to set whether to generate a link

For example, jfreechart chart = chartfactory. createpiechart3d (title, dataset, true, true, false );

Jfreechart chart = chartfactory. createpiechart (title, dataset, true, true, false );

Bar chart:

Jfreechart can be used to generate a bar chart of a common effect or a bar chart of a 3D effect:

Normal Bar Chart: chartfactory. createbarchart ()

3D bar chart: chartfactory. createbarchart3d ()

Entry parameters and functions of the Bar Chart Method:

Parameter 1: String title-chart title

Parameter 2: String categoryaxislabel-title of the statistical category axis, which can be understood as the title of the X axis.

Parameter 3: String valueaxislabel-title of the statistical value axis, which can be understood as the title of the Y axis.

Parameter 4: categorydataset dataset-plotting Dataset

Parameter 5: plotorientation orientation-used to set the orientation of the column chart, vertical: plotorientation. vertical;

Level: plotorientation. Horizontal

Parameter 6: Boolean legend-used to set whether to display the legend

Parameter 7: Boolean tooltips-used to set whether a standard generator is used

Parameter 8: Boolean URLs-used to set whether to generate a link

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.