Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
635 views
in Technique[技术] by (71.8m points)

hibernate - how can I implement a XYLine jfreechart in java

I am new to jfreechart.I want to display a chart based on values from my data base table Table is dns_time with fileds dns_lookup_time,update_time. I want update_time on x-axis and dns_lookup_time on y-axis.And the curve should be displayed according to the values from the database.I am using hibernate and postgresql.Can any one help me how to achieve this.Thank you.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You might look at JDBCXYDataset, which can detect a time series based on metadata. As noted in the API, "The first column will be the x-axis and remaining columns y-axis values." Click on the class name to see the corresponding source, for example.

Addendum: If you don't want to use JDBCXYDataset directly with a JDBC query, it may be a useful outline of how to extend AbstractXYDataset to create a dataset based on a corresponding JPA query.

class JpaXYDtaset extends AbstractXYDataset {
    // implement required methods using JPA query results
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...