Chapter 26: Drawing Charts


Instructions for Project Execution

This section describes the detailed instructions to execute the application code provided with this book.

Steps to Create the Database

Perform the following steps to create the database and tables:

  1. Choose Start, Programs, Microsoft SQL Server, Query Analyzer. The Connect to SQL Server dialog box appears.

  2. Provide the name of the SQL server. Provide the user authentication information and click OK.

  3. Ensure that you are connected to the Master database. If you are not connected to the Master database, select it from the Database drop-down list.

  4. Chose File, Open.

  5. In the Open Query File dialog box, select Project7.sql. This script creates the SalesAnalysis database and the tblCustomers, tblParameters, and tblSalesData tables. If the SQL server is installed in C:\, you do not need to modify the script. If the SQL server is installed in any other path, modify the database path in the script.

  6. Click the Execute button on the toolbar to execute the Project7.sql script. This creates the database and the tables.

Perform the following steps to import the data from an Excel file to the tables:

  1. Start the SQL Server Enterprise Manager.

  2. Right-click the SalesAnalysis database in the Enterprise Manager.

  3. Select All Tasks, Import Data from the pop-up menu. This starts the Data Transformation Services Import/Export Wizard. Click the Next button to proceed to the next screen.

  4. The Choose a Data Source screen appears. Select Microsoft Excel 97–2000 from the Data Source drop-down list and choose the Excel file Project7Data.xls. Then click the Next button.

  5. The Choose the Destination screen appears. Click the Next button to continue.

  6. The Specify Table Copy or Query screen appears. This copies the tables in the Excel file to the SalesAnalysis database. Click the Next button to continue.

  7. The Select Source Tables and Views screen appears. Select the tables to import the required tables and click the Next button to continue.

  8. The Save, Schedule, and Replicate Package screen appears. Select the Run Immediately option and then click the Next button to continue.

  9. Click the Finish button to close the wizard.

For the tblCustomers table, the Email field is empty in the sample data. This field should contain a valid e-mail address.

For the tblParameters table, enter the data as given in Table 26.1.

Table 26.1: Sample Data for the tblParameters Table

Field

Data

SMTPServer

The SMTP server TCP/IP address. This address will be used to send e-mails.

POPServer

The POP server TCP/IP address. This address will be used to receive e-mails.

CurrentYear

2001.

CurrentMonth

Feb.

UserName

The user name for the e-mail account that is used to receive e-mails.

Password

The password for the e-mail account that is used to receive e-mails.

FromEmailAddress

This e-mail address will be used when e-mails are sent from the application. The customers will get e-mails from this address.

Steps to Test the Application in ColdFusion MX

Create the data source as follows:

  1. Start ColdFusion MX Administrator. This is usually located at http://localhost/CFIDE/Administrator/index.cfm, but the location can be different as per the setup.

  2. Provide the password. The main screen appears.

  3. Navigate to data sources under the Data and Services section.

  4. Create a data source named SalesAnalysis for SQL Server.

Set up the mail server as follows:

  1. On the main ColdFusion MX Administrator page, to the left, under the Server Settings section, click the Mail Server subheading.

  2. The Mail Server Settings page is displayed. On this page, the information to be provided is divided into two sections: Mail Connection Settings and Mail Logging Settings.

  3. In the Mail Connection Settings section, enter the IP address of the mail server. Accept default values for Server Port, Connection Timeout, and Spool Interval. Check the Verify Mail Server Connection option to verify the connection when the information on this form is submitted.

  4. In the Mail Logging Settings section, select the Warning for Error Log Severity option. Check the Log All E-Mail Messages Sent by ColdFusion option to enable the recording of messages in the log file.

  5. Click the Submit Changes button. If the server is successfully updated, it displays the Successful Update Message page.

Perform the following steps to specify the chart settings in the ColdFusion MX Administrator:

  1. On the main ColdFusion MX Administrator page, under the Server Settings section, click the Charting subheading to display the Charting Settings page.

  2. On this page, set the Cache Type to Disk Cache if RAM on the Web server is already being used for other processes. If you have free RAM on the server, select Memory Cache. Memory Cache is faster, but it consumes memory.

  3. Accept the default value of the maximum number of images in the cache. Set the maximum number of charting threads to 4. Accept the default value of the disk cache location.

  4. Click the Submit Changes button. If the server is successfully updated, it shows the successful update message page.

Test the application as follows:

  1. Create a directory named ProjectSeven under the wwwroot directory on the Web server.

  2. Copy all the .cfm files in the ProjectSeven directory.

  3. Start the browser and open the login.cfm page (http://hostname/ProjectSeven/Start.cfm).

The application also assumes the Web server to be installed in C:\.

The various ways to represent data are tables, figures, charts, and graphs. Charts and graphs provide a pictorial view of the data, making data interpretation and comparisons much simpler and easier. You can create two-dimensional or three-dimensional charts and manipulate their features, such as captions, legends, and gridlines.

ColdFusion version 5.0 introduced charts and graphs, with the <cfgraph> and <cfgraphdata> tags to implement graphs. Both tags are now deprecated in ColdFusion MX, and they may not provide accurate results. ColdFusion MX has come up with new tags, including <cfchart>, <cfchartseries>, and <cfchartdata>.

In this chapter, you'll learn how to use these tags and create different types of charts. You'll learn how to link the chart areas to different URLs. You'll also learn how to use querying to create charts and graphs.




Macromedia ColdFusion MX. Professional Projects
ColdFusion MX Professional Projects
ISBN: 1592000126
EAN: 2147483647
Year: 2002
Pages: 200

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net