JFreeChart TimeSeries Chart - JFreeChart

What is the use of TimeSeries Chart in JFreeChart?

Time series chart will display a sequence of data points, which vary at equal intervals of time. This chapter will explain you how to use JFreeChart for creating Time Series Chart from a given set of business data.

Business Data

For example, consider different random numbers generated by using standard Java API Math.random(). These numbers are used for generating a Time Series Chart. Similar chart can also be prepared for total number of errors occurring in your website at a given interval of time.

AWT Based Application

Below is the code for creating Time Series Chart from the numbers generated by Math.random() at a given time internal.

Keep the above Java code in TimeSeries_AWT.java file, and then compile and run it from the command prompted as

If everything is working fine, it will compile and run to generate the following Time Series Graph

timechart_awt.jpg

JPEG Image Creation

Re-write the above example to generate a JPEG image from a command line.

Keep the above Java code in TimeSeriesChart.java file, and then compile and run it from the command prompted as

If everything is working fine with your environment, it will compile and run to create a JPEG image file TimeChart.jpeg file in your current directory.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JFreeChart Topics