I have created a csv file,

and display data from database into that file,

how can I add a pie chart to that file,

this is the code which I made:

File file = new File("C:/Users/MY TOSHIBA/Desktop/chart.CSV");
Writer output =null;
output = new BufferedWriter(new FileWriter(file));

Connection con = DriverManager.getConnection("jdbc:oracle:thin:@","username","password");
String sql="select * from mawarid";

Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
 String teller =rs.getString("name");
 String flag=rs.getString("flag");


csv is a text file format. What kind of pie chart do you want to add to a text file?
If you want a proper graphic pie chart then you will have to use a more capable file format, eg pdf.

It is possible to do a pie chart manually in a csv or an excel file, I am asking if there's a way to do it using java.

Can you post an example of a csv with a pie chart as you want to see it?

Ok, is it possible to display it in an excel file.