How can I customize the x-axis of line charts?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
laredotornado
Posts: 3
Joined: Wed Nov 03, 2004 8:28 pm

How can I customize the x-axis of line charts?

Post by laredotornado » Wed Nov 03, 2004 8:35 pm

Hello, I just downloaded JFreeChart 0.9.21 for my JDK 1.3 on Solaris. I create a line chart from a query that returns thousands of rows. But there are no labels whatsoever marking points along the x-axis. How can I set up just a few labels to appear? Here is my code:

JDBCCategoryDataset lineDataSet = null;
Connection con;
try {
con = DBDaemon.getConnection(sPool);
lineDataSet = new JDBCCategoryDataset(con);
lineDataSet.executeQuery(sQuery);
con.close();
}
catch (SQLException e) {
System.err.print("SQLException: ");
System.err.println(e.getMessage());
throw new RuntimeException(e.getMessage());
}
catch (Exception e) {
System.err.print("Exception: ");
System.err.println(e.getMessage());
throw new RuntimeException(e.getMessage());
}

JFreeChart chart = ChartFactory.createLineChart
(sTitle, // Title
sDomainLabel, // Domain access label
sRangeLabel, // Range access label
lineDataSet, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
true, //legend
true, // tooltips
false
);

Avatar Viper

Post by Avatar Viper » Thu Nov 04, 2004 3:42 am

Which dataset are you using?

laredotornado
Posts: 3
Joined: Wed Nov 03, 2004 8:28 pm

Post by laredotornado » Thu Nov 04, 2004 9:08 pm

I am using JDBCCategoryDataset. This is the complete fragment.

JDBCCategoryDataset lineDataSet = null;
Connection con;
try {
con = DBDaemon.getConnection(sPool);
lineDataSet = new JDBCCategoryDataset(con);
lineDataSet.executeQuery(sQuery);
con.close();
}
catch (SQLException e) {
System.err.print("SQLException: ");
System.err.println(e.getMessage());
throw new RuntimeException(e.getMessage());
}
catch (Exception e) {
System.err.print("Exception: ");
System.err.println(e.getMessage());
throw new RuntimeException(e.getMessage());
}

chart = ChartFactory.createLineChart
(sTitle, // Title
sDomainLabel, // Domain access label
sRangeLabel, // Range access label
lineDataSet, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
true, //legend
true, // tooltips
false
);

Locked