In bar chart, the data is dynamic from DB at run time. My problem is that-
If data set having less number of data's(less no. of record sets) then the chart's bars width are big. How can I control it?
chartPanel = new ChartPanel(test()); jPanel1.add(chartPanel, BorderLayout.CENTER); public static JFreeChart test() { String query = "SELECT num1,num2 from test1 ; JFreeChart cha; try { JDBCCategoryDataset dataset = new JDBCCategoryDataset("jdbc:mysql://localhost:3306/db", "com.mysql.jdbc.Driver", "root", ""); dataset.executeQuery(query); cha = ChartFactory.createBarChart3D("xxxx", "xxx", "xxx", dataset, PlotOrientation.VERTICAL, true, true, false); } catch (Exception e) { System.out.println(e); } return cha; }
Is there a way to adjust the width of the bars in a Barchart.
If you can try fixing the Maximum number of bars your graph can show.
Because any how if you manage to fix the width of bars but if the number of bars will be large then the bars will overlap.
So fix the maximum number of bars your graph can show.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.