FMStudio Charts Module
From FMWebschool Reference
The FMStudio Charts Module allows FMStudio users to create powerful charts from FMStudio recordsets that display live FileMaker data graphically. Currently nine types of charts are supported which include pie charts, bar charts, line charts, and even a scatter plot.
Version 1.0.0 (July 31, 2007)
- Charts module released with support for 9 core chart types
- Color customization is supported for backgrounds, fills, and lines
Version 1.0.4 (November 17, 2007)
- Added support for regular PHP pages for non-FMStudio users
Version 1.1.0 (February 18, 2008)
- Fixed Legend and Title size bug for pie charts
Version 2.0.0 (October 15, 2009)
- Added FMStudio Pro compatibility to the module
- In a new FMStudio PHP page insert a recordset to find multiple records
- Select a region on the page where you want to display this chart
- Select "Server Behaviors > Modules > Charts > Charts Module"
- Select the recordset, and two fields that will act as the x and y axis for your chart
- Select a chart type from the drop down list
- Select the chart settings, it is very important to specify the desired size
- Width of 600 and height of 400 works well as a generic combination
- Select some color settings, or just confirm the defaults as your desired choice
- Click "Ok" and save the page, then click "Preview in Browser" to open up the page in your browser
- You are done, when you will load the page a chart should appear with the data within the recordset graphed as your selected chart type
1. Positioning within the Page
- The charts module must be applied somewhere within the visible area of your design view
- The appropriate IMG tags will be created automatically by PHP once the charts object is placed on the page
2. Settings, Sizes, and Colors
- The size selection in the chart settings are for the overall image, each chart type dedicates space slightly differently within this "canvas", when in doubt try a few different sizes to find the perfect one for your task.
- Labels and units are used to add text to some charts and give more meaning to the data
- Please note that changing a chart type for an existing chart object will often incorrectly set default colors and settings. Make sure to double check all settings if you have changed a chart type.
- If your chart is not behaving properly after a significant edit to its settings, try creating a new chart module object from scratch
3. Using Portals or Related Records
- If you want to display a chart using related records to the current single record that is being browsed, then it is best to create a separate layout that displays the records in the portal as the main records on the layout. Once that is setup, use your POST or GET variables for the page in a recordset that searches within that portal for the set of related records.
Frequently Asked Questions
Can multiple lines be displayed on a single line chart?
While the core PEAR library that the Charts Module uses does support multiple lines for a single line chart, there is no current interface within the charts module for this feature. Support for it is certainly planned for the future but will require a way to combine multiple recordsets or portals into a single chart object.
Can the "multi-color pie chart" colors be customized?
Yes! Just take a look at the first few lines in the Charts_Module/charts.php file within your site to find the following color definition array:
$FMStudio_Upload_PIE_COLORS = array( '#FF0000', '#FFFF00', ... snipped for clarity ... '#FF00FF', );
As you can see, the colors are defined in HTML hex values (and some string might work as well such as 'red' or 'green') and are placed into a big array. Simply modify the array with the number of colors that you want on your pie chart, if there are more pie slices within your chart than there are colors - the color list above will just continue repeating.