-3

I want to generate graphs using data from MySQL. I have tried the JFreeChart library, but it's not working in my project. I want to know which library can generate graphs better than JFreeChart, but also how to modify my JFreeChart code to work better than it does now. Thanks.

Code:

String query="select Entropy,TimeStamp from entropy where profile='Bandwidth in of all interface' order by walkinggroup";
ConnectDB conn=new ConnectDB("ip","root","124563");
JDBCCategoryDataset dataset=new JDBCCategoryDataset(conn.getConnection(),query);
JFreeChart chart=ChartFactory.createLineChart("entropy", "TimeStamp", "Entropy", dataset, PlotOrientation.VERTICAL, false, true, true);
BarRenderer renderer=null;
CategoryPlot plot=null;
renderer=new BarRenderer();
ChartFrame frame=new ChartFrame("Query chart",chart);
frame.setVisible(true);
frame.setSize(1000, 1000);

// graph now /

// database table

  • 2
    For anyone to help you troubleshoot your code - you need to actually post it first ;-) Along with a brief explanation of what you expected to happen instead. As far the "better libraries", that is a subjective question, which is not really [on-topic for SO](http://stackoverflow.com/help). – Leigh Jan 14 '14 at 18:39
  • i have post my code done ! plz help me tanks – user3194883 Jan 15 '14 at 13:32
  • Re edit: Why `JDBCCategoryDataset`? `JDBCXYDataset` will recognize the timestamp. – trashgod Jan 15 '14 at 17:37

1 Answers1

3

I like JDBCXYDataset, mentioned here, for this. Absent a complete example, it looks like you've defeated the default auto ranging feature on the range axis, perhaps by invoking setAutoRangeIncludesZero(true). The effect is to minimize the already small variability in your entropy values.

As for alternatives, see also FAQ 13. Are there other "open source" chart libraries?.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045