
Hi, Can Any one help out! How to show database values in Graph. i mean while changing values in database,the corresponding curve should change accordingly.(Like Cricket score board Graph)

import java.sql.*;
import org.jfree.chart.*;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.xy.*;
import org.jfree.data.*;
public class Chart{
public static void main(String arg[])throws Exception{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root" );
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("SELECT * from cricket_match");
XYSeries series = new XYSeries("");
while(rs.next()){
series.add((double)rs.getInt("runs"),(double)rs.getInt("overs"));
}
XYDataset xyDataset = new XYSeriesCollection(series);
JFreeChart chart = ChartFactory.createXYLineChart
("Match Score", "Runs", "Overs",
xyDataset, PlotOrientation.VERTICAL, true, true, false);
ChartFrame frame1=new ChartFrame("",chart);
frame1.setVisible(true);
frame1.setSize(300,300);
}
}

Hello Deepak, I am New To Jfreechart....i dnt knw how to compile jfree programs? Please suggest me...
Thanks & regards, Praveen

kk i got the idea about jfree...but how thw j frame window will auto refresh.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.