e.printStackTrace(); System.out.println(e.getMessage()); } } public void ShowChartData(String Data1, String Data2) { try { bar = new NFBarchartApp(this); // Instantiate the bar chart class bar.init(); bar.start(); // Initialize it, and start it running. // Below is where we load the parameters for the chart. // See the documentation at the NetCharts Web site, or // the CD-ROM for details. bar.loadParams( “Header = (’Salary Information’);”+ “DataSets = (’Salary’, red);”+ “DataSet1 = “+ Data1 + “;”+ “BarLabels = “+ Data2 + “;”+ “GraphLayout= HORIZONTAL;”+ “BottomAxis = (black, ‘TimesRoman’, 14, 0, 0,100000)” ); bar.loadParams (”Update”); // Tell the bar chart class we’ve put // some new parameters in. } catch (Exception e) { System.out.println (e.getMessage()); } } // More to come following some comments The bar chart class from the NetCharts package uses a method to load the values for the chart. We have to define the labels and corresponding values, but this is generally straightforward. Because our data is formatted in a comma-delimited fashion, we don t have to parse the data again to prepare it for use. In the next example (the pie chart example), we do have to parse it to put it in the proper format for the charting class to recognize it. Listing 7.4 picks up the code where we left off in Listing 7.3. Listing 7.4 Dynamically generating a bar chart from a database query Part II. public String[] getData( String QueryLine ) { int columns, pos; String column[]=new String[4]; boolean more; try {
Please check our cheap domain web hosting services, our secret is fast and stable servers, dedicated 24/7 customer support, and many useful FREE bonuses.