You are on page 1of 6

Crystal Reports

How to Create a Two Series Line Graph in Crystal Reports

Overview
This document outlines how to create a two line graph in Crystal Reports (CR), and can be used as a template for creating multi-line graphs (>2 lines) as required. The example used is outlining how to graph two Sales Totals by Month, with each line representing a different Years data (1994 and 1995).

Contents
PART 1: SETTING UP THE REPORT ...............................................................2 PART 2: CREATING THE GRAPH ...................................................................4 FINDING MORE INFORMATION .......................................................................5 CONTACTING CRYSTAL DECISIONS FOR TECHNICAL SUPPORT ......................5

6/25/2002 4:31 PM

Copyright 2002 Crystal Decisions, Inc. All Rights Reserved.

Page 1

Crystal Reports

How to Create a Two Series Line Graph in Crystal Reports

Part 1: Setting up the Report


Step 1:

Create a New Custom Report. Select your tables.


NOTE
For this example, the sample database that comes with Microsoft Access Northwind.mdb has been used; the only tables selected are Orders and Order Details.

Step 2:

Create 4 formulas: Using Insert/Formula Field


NOTE
All these formulas will work with Northwind.mdb. Your situation may vary especially the necessity to create a formula to create an order total.

@month // This formula will extract the month name as an integer using the Month(x) function. Month({Orders.Order_date}) @Order_Total // This formula may or may not be necessary; it derives the total value of any order {Order Details.UnitPrice}*{Order Details.Quantity} @1994 // This formula determines if the order happened in 1994 if year({Orders.OrderDate}) = 1994 then {@order_total} else 0 @1995 // The same formula as above but for 1995 if year({Orders.OrderDate}) = 1995 then {@order_total} else 0
Step 3:

Insert the database field {OrderID} and the formula fields @1994 and @1995 in the detail section of the report.
6/25/2002 4:31 PM
Copyright 2002 Crystal Decisions, Inc. All Rights Reserved.

Page 2

cr_line_graph_two_series.pdf

Crystal Reports

How to Create a Two Series Line Graph in Crystal Reports

Step 4:

Create a group based on a specified order. There will be twelve items in the specified order -- January through December. To create this group: 1. Select Insert/Group. 2. Sort and Group on the Month formula IN SPECIFIED ORDER 3. In defining the specified order, follow the below pattern for each of the months After selecting " in specified order", you will type "January" in the Named Group text box. Click New, the Define Named Group dialog box appears. Define the group as "January is equal to 1". Repeat this step for the other months changing the names and month number appropriately.

Step 5:

Highlight the @1994 formula field and create a subtotal that will appear in the group footer of the group you just created.
Step 6:

Create, as above, a subtotal for the @1995 group.


Step 7:

Drag the group name from the header or place a group name field in the footer.
Step 8:

Hide or suppress, as you prefer, the details section. At this point, if you preview a cross-tab style report should exist:

Now it is time to create the graph!

6/25/2002 4:31 PM

Copyright 2002 Crystal Decisions, Inc. All Rights Reserved.

Page 3

cr_line_graph_two_series.pdf

Crystal Reports

How to Create a Two Series Line Graph in Crystal Reports

Part 2: Creating the Graph


Step 1:

Select Insert/Graph-Chart Expert. Choose the Line Graph type. Click the DATA tab and select the DETAIL/FORMULA button.
Step 2:

In the resulting dialog box set the following options: Put graph ONCE PER REPORT On change of @month Values are: @1994 and @1995

Step 3:

Click the GRAPH DONE button. Preview your report, and at this point the line chart should exist as desired. If you would like to fine tune the graph: 1. Right click on the chart and select format chart. 2. Click Custom, the Crystal Chart Editor appears. Please note that if you want to re-edit the chart click PGEditor not Custom. 3. From the file menu, select Apply Template. 4. You will have to select a *.3df template from the c:\crw\gallery\line directory. Assuming, of course, a standard installation to the "C" drive. Try line.3df.
6/25/2002 4:31 PM
Copyright 2002 Crystal Decisions, Inc. All Rights Reserved.

Page 4

cr_line_graph_two_series.pdf

Crystal Reports

How to Create a Two Series Line Graph in Crystal Reports

NOTE

Version CR 6.0 32-bit users look for *.3TF template files.

5. Select File/Exit, Save the chart, Click Graph Done in the Graph/Chart Expert Window. 6. After applying the template, your graph should look similar to this:

Finding More Information


Search for the following related file(s) and update(s)on our support site at http://support.crystaldecisions.com/downloads: cr6_graphing_tutorial.zip

This document demonstrates how to create and modify graphs in version 6 of both the Crystal Report Designer and Seagate Info Report Designer. Also includes a number of tips and tricks not currently documented in the User's Guide, and some sample graphing reports.

Contacting Crystal Decisions for Technical Support


We recommend that you refer to the product documentation and that you visit our Technical Support web site for more resources.
Self-serve Support:

http://support.crystaldecisions.com/
Email Support:

http://support.crystaldecisions.com/support/answers.asp
Telephone Support:
6/25/2002 4:31 PM
Copyright 2002 Crystal Decisions, Inc. All Rights Reserved.

Page 5

cr_line_graph_two_series.pdf

Crystal Reports

How to Create a Two Series Line Graph in Crystal Reports

http://www.crystaldecisions.com/contact/support.asp

6/25/2002 4:31 PM

Copyright 2002 Crystal Decisions, Inc. All Rights Reserved.

Page 6

cr_line_graph_two_series.pdf

You might also like