The Largest Repository of ColdFusion Knowledge in The World for More Than 12 Years

ColdFusion on Ulitzer

Subscribe to ColdFusion on Ulitzer: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get ColdFusion on Ulitzer: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


CFDJ Authors: AppDynamics Blog, Michael Kopp, Tad Anderson, Bob Gourley, Jayaram Krishnaswamy

Related Topics: ColdFusion on Ulitzer

CFDJ: Article

Swiff Chart from GlobFX

Professional charting for your ColdFusion applications

In its simplest form, text-based data provides a basic view of its structure and meaning. Charting enhances that view and puts the data in an entirely different light. ColdFusion has offered charting capabilities since version 5.0, but the functionality has always lacked some finesse - something that is present in other commercial charting solutions.

I discovered Swiff Chart, a charting product, while working on a project for a client. This client required a charting solution that would produce professionallooking charts within their content management solution. Unfortunately for the client, ColdFusion's built-in charting didn't produce the impact that the client desired. After some fairly extensive investigating, I found GlobFX Technologies (www.globfx.com), the company behind Swiff Chart.

GlobFX goes about their charting solution in a different sort of way. Their solution includes two products: Swiff Chart and Swiff Chart Generator.

Swiff Chart is a robust client-side chart generation tool. This complete tool allows for data input to styling the chart, and then exporting them into several formats, such as SWF, PNG, BMP, and JPG to name a few. Swiff Chart Generator is a server-side product that generates charts dynamically. It supports ASP, PHP, and ColdFusion, and runs on Windows, Linux, and Solaris. However, it only supports ColdFusion on the Windows platform, due to the use of COM. (COM is the means for ColdFusion to talk to the server.)

Both the client-side and the serverside products can generate a number of charts, including pie, bar, line, column, and XY scatter charts. GlobFX has just released a new version of the two products, which will additionally generate combination, area, bubble, and stock charts.

Making a Chart Style
Every copy of the Swiff Chart Generator product includes the clientside tool, since the client-side tool also doubles as a “style sheet” generator for the server-side solution. This approach allows you to enter data into the client tool and see what your chart will look like as you change the various chart style properties. When you have finished designing a chart style sheet, it can be saved and used when you generate your charts dynamically. If you're not a designer at heart, the client-side tool has several built-in styles to get you started.

There are many options in the client tool to assist in creating a chart style. We'll walk through the main tabs of the client tool. The Data tab is where you enter your labels and values. This data can either be entered manually or imported from a spreadsheet (we'll discuss dynamic charting later in the article). After you have established the data, you're ready for the next step - styling the chart (see Image I).

As you can see, there are various built-in styles to choose from, as well as the ability to load previously created styles. To construct a new style, select a plot style and then begin customizing the various options to make your own unique look. Being able to change the visual impact of your charts live is a much more intuitive approach than changing source code. After selecting your plot style (i.e., bar, line, pie, etc.), you can then begin customizing the individual properties of the chart (see Image II).

The Plots tab has various options available, from changing the fonts and colors of the values to selecting the colors for the columns and borders. Aside from just choosing solid colors, you have the option of custom gradient fills, which adds some flair to the chart. The rest of the tabs permit customization to the axes, legend, title, background, and the general layout of the chart.

The interface to the client tool is quite easy to work with; it's very similar to a Paint type application. Almost every conceivable part of the chart can be customized from this tool: values, axis, legends, colors, and a neat feature animation. The charts already look fantastic, but the animation supplements the impact of the charts by animating the bars or pie slices as they are drawn. For an example of this, view the online example I created at www.fusetalk.com/cfdj/swiff demo.html.

Server-Side Generation
After you've played the designer role and created chart styles, you can then either save your charts right from the client tool, or save the chart styles and plug them into the server-side generator. The server-side generator installs a COM object. This object provides the means for the communication between ColdFusion and the server. This permits you to create charts dynamically using the server-side generator.

This is a very simple task. There are two choices for talking to the COM object: JScript and VBscript. Each language has an array of methods and properties that you have at your disposal (see Image III).

If the application in which you are deploying Swiff Chart Generator gets a fair amount of traffic, you can use the built-in caching functionality to alleviate the load. Swiff Chart Generator allows you to turn caching on and off, and to define where the chart cache will be kept from a server module (see Image IV). You can also change the caching parameters from the JScript or VBScript interface to the COM Object (see Code I).

GlobFX supplies quite a number of sample code snippets to get you started in generating charts. I've written a CFC to illustrate just how extensible, yet simple, this tool is to use.

As illustrated in this code snippet, talking to the COM object is very easy, and the properties that I've used in this example are only a snapshot of the properties available. To generate my first chart, I called the CFC with the code shown below, and produced a very professional- looking chart.

<cfscript>
ChartObj =
CreateObject("component","swiffchart");
ChartObj.GenerateChart("a|b|c|d|e","1|
2|3|4|5","2|4|6|8|10","First
Series","Second
Series",560,420,true,"My First
Chart","the subtitle","c:\inetpub\wwwroot\
SanFrancisco.scs");
</cfscript>

Pricing for Swiff Chart starts at $149 USD for the client tool and $799 USD for the Generator tool, which includes a copy of the client tool (see Image V). GlobFX (www.globfx.com) also offers evaluation versions of both products, which are downloadable from their Web site. If professional charts are a requirement in your next project, this product should be on your list. It's easy to use and flexible, and the great-looking charts make it a strong contender in aftermarket charting solutions.

More Stories By Jason Clark

Jason Clark, cofounder and CTO of e-Zone Media Inc., has more than 10 years of experience in programming specifically and the IT sector in general.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.