[英]JFree Bar Chart - Bar width?
在條形圖中,運行時來自DB的數據是動態的。 我的問題是
如果數據集的數據量較少(記錄集的數目較少),則圖表的條形寬度較大。 我該如何控制?
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; }
有沒有辦法調整條形圖中的條形寬度。
如果您可以嘗試固定圖形可以顯示的最大條數。
因為如果您設法固定條的寬度,但是如果條的數量很大,那么條將重疊。
因此,確定您的圖形可以顯示的最大條形數量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.