I have done the following codes to create a bar chart with the data from DB, and save it as an JPEG file.

I wanted to add percentage value anywhere in the table,

 JDBCCategoryDataset dataset = new JDBCCategoryDataset("", "oracle.jdbc.OracleDriver",
                           "", "");
    String query = "SELECT std,id from table";
    dataset.executeQuery(query);
    JFreeChart chart =ChartFactory.createBarChart3D("Test", "Id", "Score",dataset,
    PlotOrientation.HORIZONTAL, true, true, true);
    ChartUtilities.saveChartAsJPEG(new File(""),chart,1280, 1024);

Please advise.

Click Here

The StandardPieSectionLabelGenerator can do that for you. Check link and documentation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.