Hey Pete,
I have an SQl stament that returns data see Data Attachment.
I have created a Chart see Chart Attachemnt.
I would like to display the server listed on the Y-Axis instead of the Legend.
I've tried a number of ways but no results.
Here is the current code I'm using:
String SQL = "select server,sum(clone),sum(conn),sum(disk),sum(dr),sum(http),sum(ISS),sum(netc),sum(nete),sum(osby), sum(ospcc), sum(ostac), sum(pp_critical),sum(procs),sum(Stuck) from xx_xx_xxx_xxxxx where mmyyyy = '3/2011' Group by server order by server";
String dbFile = "xx_xx_xxx_xxxxx ";
Class.forName("oracle.jdbc.driver.OracleDriver");
java.sql.Connection dbConn = java.sql.DriverManager.getConnection
(MM_indca49d_STRING,MM_indca49d_USERNAME,MM_indca49d_PASSWORD);
java.sql.PreparedStatement stmt = dbConn.prepareStatement(SQL);
//rs = java.sql.ResultSet object representing your query
ResultSet rs = stmt.executeQuery(SQL);
// Create a XYChart object of size 600 x 300 pixels, with a light grey (eeeeee)
// background, black border, 1 pixel 3D border effect and rounded corners.
XYChart c = new XYChart(1200, 600, 0xeeeeee, 0x000000, 1);
//c.setRoundedFrame();
// Set the plotarea at (100, 60) and of size 1040 x 400 pixels. Set background color to white (ffffff) and border and grid colors to grey (cccccc)
// Turn on both horizontal and vertical grid lines with light grey color (0xcccccc)
c.setPlotArea(100, 110, 1040, 400, 0xffffff, -1, -1,0xcccccc, 0xccccccc);
// Add a title to the chart using 15pts Times Bold Italic font, with a light blue
// (ccccff) background and with glass lighting effects.
c.addTitle("Errors for " + request.getParameter("txtYear"), "Times New Roman Bold Italic",
15).setBackground(0xccccff, 0x000000, Chart.glassEffect());
// Add a legend box at (70, 32) (top of the plotarea) with 9pts Arial Bold font
c.addLegend(70, 32, false, "Arial Bold", 9).setBackground(Chart.Transparent);
// Add a line layer to the chart
LineLayer layer = c.addLineLayer2();
while (rs.next())
{
String myName = rs.getString(1);
double[] myData = {
rs.getDouble(2),
rs.getDouble(3),
rs.getDouble(4),
rs.getDouble(5),
rs.getDouble(6),
rs.getDouble(7),
rs.getDouble(8),
rs.getDouble(9),
rs.getDouble(10),
rs.getDouble(11),
rs.getDouble(12),
rs.getDouble(13),
rs.getDouble(14),
rs.getDouble(15) };
layer.addDataSet(myData, -1, myName);
}
// Use soft lighting effect with light direction from the left
layer.setBorderColor(Chart.Transparent, Chart.softLighting(Chart.Left));
// The labels for the line chart
String[] labels = {"Clone","Conn","Disk","DR","Http","ISS","Netc","Nete","OSby", "OSpcc", "OStac", "PP_critical","Procs","Stuck"};
c.xAxis().setLabels(labels).setFontAngle(60);
|