Date Time on x-axis using JFreeChart

2019-08-29 07:22发布

问题:

I would like to create a graph using data from a database (Oracle). The dataset contains DateTimeStamp values and numeric values The DateTimeStamp values are for intervals of 15 minutes and usually extend for a period greater than one calendar day. The DateTimeStamp values need to be graphed against the X-axis and the data values (numeric) will be graphed against the Y-yxis. The x-axis major tic marks should be the calendar days. I have purchased the enterprise version of JFreeChart but the username password provided does not allow me to ask questions on their forum, and sending email to the owner results in no response.

Thanks for any help you can offer. A working code block/snippet would be ideal and much appreciated.

回答1:

Look at JDBCXYDataset, which uses the query's ResultSetMetaData to recognize Types related to date and time. Complete examples are seen here and here.

As an aside, access to the support forum is free; just click the register link.