how can I implement a XYLine jfreechart in java

走远了吗. 提交于 2019-11-28 11:24:01

问题


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.


回答1:


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
}


来源:https://stackoverflow.com/questions/16958898/how-can-i-implement-a-xyline-jfreechart-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!