The JFreeChart Class Library. Version Developer Guide. Written by David Gilbert. January 7, cс , Object Refinery Limited. All rights. The JFreeChart Class Library. Version REFERENCE DOCUMENTATION. Written by David Gilbert. June 14, c , Simba Management. The JFreeChart project was founded in February , by David Gilbert. Today, it is the most widely used charting library among Java developers. This tutorial.
|Published (Last):||3 September 2009|
|PDF File Size:||3.85 Mb|
|ePub File Size:||2.30 Mb|
|Price:||Free* [*Free Regsitration Required]|
JFreeChart tutorial – learn how to create charts in Java
In this tutorial, we learn how to use JFreeChart. We show how to create various types of charts. The charts are displayed in a Swing application and saved to an image dsveloper. We use a Java servlet to create and render a chart in a web browser and retrieve data for a chart from a MySQL database. A chart is a drawing that shows information in a simple way, often using ifreechart and curves to show amounts.
JFreeChart is a popular Java library for creating charts. JFreeChart allows to create a wide variety of both interactive and non-interactive charts. We can create line charts, bar charts, area charts, scatter charts, pie charts, gantt charts and various specialized charts such as wind chart or bubble chart.
JFreeChart is extensively customizable; it allows to modify colours and paints of chart items, legends, styles of the lines or markers. It automatically draws the axis scales and legends. Charts have degeloper built-in capability to zoom in with mouse. The existing charts can be easily updated through the listeners that the library has on its data collections. JFreeChart was started by David Gilbert in Today, JFreeChart is the most widely used charting library among Java developers.
A line chart is a basic type of chart which displays information as a series of data points connected jfeeechart straight line segments. The parameters of the method are: Here, gudie set a stroke and a colour for the line of the chart. The renderer is set with the setRenderer method. ChartUtilities is a collection of utility methods for JFreeChart.
It includes methods for converting charts to image formats and creating simple HTML image maps.
Dave Gilbert’s Weblog
An area chart displays graphically quantitative data that change over time. An area chart is created with ChartFactory.
A dataset is created with the DatasetUtilities. A category dataset values associated with categories. In our examples, we have years associated with oil consumption.
A bar chart dveloper grouped data with rectangular bars with lengths proportional to the values that they represent.
The bars can be plotted vertically or horizontally. The code example uses a bar chart to show the number of Olympic gold medals per country in London A pie chart is a circular chart which is divided into slices to illustrate numerical proportion.
A pie chart is created with the ChartFactory. In the following example, we use a Java servlet to create a pie chart. The chart is rendered in a web browser.
With the getOutputStream method we get an output stream. It is a tunnel to which we send the data.
The dataset is populated guidf a call to executeQuery with the string SQL query. The executeQuery populates the dataset by executing the supplied query against the existing database connection.
The SQL query must return at least two columns. The first column is the category name and remaining columns are values.
This tutorial was dedicated to the JFreeChart library. You might also be interested in develoler related tutorials: It is also possible to create charts in JavaFX.