Example 3: Charting related records
This example is based on the database of a fictitious business named Favorite Bakery. Use the FileMaker Pro tutorial sample file, Sample.fmp12, to create this chart. The sample file is located in:
FileMaker Pro 12/English Extras/Tutorial
or
FileMaker Pro 12 Advanced/English Extras/Tutorial
About the chart
In this example, you create a bar chart that displays discount program fees paid by corporate customers of Favorite Bakery. You will place the chart on the Companies layout, which contains address information for each company in a separate record. When you are finished, your chart will update to show data for each company as you browse through the three company records.
Save a copy of the sample file
1.
2.
You see the sample file’s Data Entry layout. It displays one record in Form View.
Create a relationship between the two tables in the database
Create a relationship between the Customers and Companies tables.
1.
Choose File menu > Manage > Database.
2.
Click the Relationships tab.
You see the relationships graph. The relationships graph shows all the tables in the current file.
When you create a relationship between two tables, you make the data stored in either table accessible to the other table.
3.
In the Customers table, click the Company field and drag a line to the Company field in the Companies table, then release the mouse button.
You see the relationship you have created. The relationship is based on matching data in the Company field in both tables. Records are related when data in the Company field in one table matches the data in the Company field in the other table (for example, when data in both tables is ABC Company).
4.
Click OK to save this relationship.
Prepare the Companies layout for the chart
1.
Choose Companies from the Layout pop-up menu in the layout bar.
Notice the Companies layout lists address information for XYZ Inc., a corporate customer of Favorite Bakery.
2.
3.
Click Edit Layout in the layout bar to switch to Layout mode.
You will place your chart below the fields already defined on this layout.
Create a bar chart to display customer fees by company
1.
Click the Chart tool Chart tool in the status toolbar, then click in the body layout part and drag a large rectangle where you want the chart to appear.
The Chart Setup dialog box appears.
2.
In the Chart inspector, click Data Source, then enter the following settings:
 
Choose Related Records.
Choose Customers.
3.
Click Chart and enter the following settings:
 
Use a calculation to enter the chart title so it updates automatically when users browse through records in the database:
Click Specify button and choose Specify Calculation. In the Specify Calculation dialog box, type the following, then click OK:
Customers from & Customers::Company
FileMaker Pro will use the text you typed as the beginning of the title and the data from the current record as the company name. Because the table associated with this layout is Companies, you must specify field names from the related Customers table for the title to display correctly.
For Title, type Amount Paid.
For Data, click Specify button, choose Specify Field Name, choose the Customers table, choose Fee Paid in the list, then click OK.
The bars in your chart will show the data values from the Fee Paid field (x-series). This is the data you are measuring.
For Title, type Customer.
For Data, click Specify button, choose Specify Field Name, choose the Customers table, choose Last Name in the list, then click OK.
Data values from the Last Name field will appear as labels for the bars in your chart. This is the data you are comparing.
Select Show data points on chart.
Select Y-Axis and for Label Angle type 40.
Tip  You can click or drag the angle control Angle control to reposition data labels.
4.
Click Done to close the Chart Setup dialog box.
You see sample data in the chart in Layout mode.
5.
Click Save Layout, then Exit Layout in the layout bar.
6.
The chart updates to show customers of the company displayed in the current record. You might need to return to layout mode and resize the chart for data to display correctly.
Related topics 
About chart types
Chart planning guidelines
Creating and editing charts in Layout mode
Changing the look of a chart
Example 1: Charting summary data
Example 2: Charting delimited data