How do I create a pie chart that displays the quantity of something registered by each someone?

前端 未结 1 564
别跟我提以往
别跟我提以往 2021-01-25 06:46

In my project, I want to display in the pie chart how many institutions each employee registered in the system. The institutions table contains a foreign key with the id of the

1条回答
  •  悲&欢浪女
    2021-01-25 07:06

    You don't need the PreparedStatement. Use the org.jfree.data.jdbc.JDBCPieDataset constructor that accepts a query "that returns data in two columns, the first containing VARCHAR data, and the second containing numerical data." You can use the dataset in your ChartFactory.

    JDBCPieDataset ds = new JDBCPieDataset(conn, "SELECT ...");
    

    A complete example is shown here.

    0 讨论(0)
提交回复
热议问题