I am getting data from db....using ResultSet You can try something like this DefaultPieDataset pieDataSet = new DefaultPieDataset(); // select subject,value from datatable; // rs will be your ResultSet while (rs.next()) { String sub = rs. GetString(1); int val = rs. GetInt(2); pieDataSet.
SetValue(sub, new Integer(val)); } If the value is not stored in integer format in the database then parse it using int val = Integer. ParseInt(rs. GetString(2)).
To dynamically update your dataset for any JFreeChart object (sorry if I don't use a Pie chart for an example, but you can figure it out): Make sure your data from DB is populated into a DataSet object where it is part of a class field. Create a class helper method that returns a JFreeChart which contains: a ChartFactory method which creates a JFreeChart object a plot object any objects that allow chart and plot rendering, etc. Pass this DataSet object to your ChartFactory method that relates to the type of chart you want Call your class helper method from an event or something that allows the chart to be updated where it passes JFreeChart object to a ChartPanel object... chartPanel. SetChart(createChart(axisX, axisY)); If you want the chart to be updated in intervals, use a Timer-based object to update the code.
For an example of such helper method can be found in my other post: Jfree chart change Y axis data.
There are several jFreeChart samples on their site here: jfree.org/jfreechart/samples.html.
– user654761 Mar 22 at 3:07 @user654761: Just load the values like you normally would, and just substitute the static values in the pie chart for the database values. – Jonah Mar 22 at 3:11 @jonah....can you please elaborate? – user654761 Mar 22 at 3:36 @user654761: Not really.
Do you already have code to extract the data from the database? – Jonah Mar 22 at 4:09 1 hi....all I got solution just use...pieDataSet. SetValue(Name, count);in resultset ..... – user654761 Mar 22 at 8:15.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.