
hii..how to display data from database and show it in piechart according to different data that is present in database..plzz help..

Here is a java example that retrieves the record from database and create a pie chart.
import java.sql.*;
import java.io.*;
import org.jfree.ui.*;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.data.*;
import org.jfree.data.jdbc.JDBCPieDataset;
public class Chart {
public static void main(String[] args) throws Exception {
String query = "SELECT * from result";
JDBCPieDataset dataset = new JDBCPieDataset(
"jdbc:mysql://localhost:3306/test", "com.mysql.jdbc.Driver",
"root", "root");
dataset.executeQuery(query);
JFreeChart chart = ChartFactory.createPieChart("Test", dataset, true,
true, false);
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
ApplicationFrame f = new ApplicationFrame("Chart");
f.setContentPane(chartPanel);
f.pack();
f.setVisible(true);
}
}
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.