Using the rChart Server Component

The server component can be used to enhance web pages, or to automate the creation of charts as data is updated. You can use the component from:

The basic steps for using the rChart server component in any context, are:

  1. Instantiate an rChart server object (FCCOM.ChartSrv)
  2. Load a workspace
  3. Set substitution values (User1 - User4), if needed
  4. Feed in data (depending on mode of use)
  5. Set query substitution parameters (if used)
  6. Load specific chart style (depending on mode of use)
  7. Refresh (if needed)
  8. Create output (stream or file)
  9. Clean up

Loading workspaces and/or styles

In order for the server component to produce a chart, it needs two things:

The chart definition comes from workspaces and/or styles. Data is also stored in the workspace, although the power of the server component comes from its ability to combine an existing definition with new data.

The simplest way to use the server component is to create a workspace containing a complete chart definition (including a data source description). That way, all the server has to do is load the workspace and refresh its data, as in the following example:

set obj=Server.CreateObject("FCCOM.ChartSrv")
obj.LoadWorkspace "my-chart-workspace.fcw"
obj.Refresh
obj.CreateSWFStream
obj.Clear
set obj = nothing

Under some circumstances, you may need to assemble your chart from an empty workspace and one or more styles, like this:

set obj=Server.CreateObject("FCCOM.ChartSrv")
obj.LoadWorkspace "my-empty-workspace.fcw"
obj.LoadStyle "my-style.fcs"
obj.Refresh
obj.CreateSWFStream
obj.Clear
set obj = nothing

This approach is usually not necessary, but may become necessary if you want to combine into one presentation more than one chart, each of which drawing on different data - see Samples\asp\example3.asp (in the rChart installation folder).

Using Substitutions

rChart defines four user values (User1 through User4) which are exposed through the rChart server component, as are two query substitution parameters (A and B). These can be used to parameterize chart captions (titles, etc.), and database queries.

Feeding in Data Programmatically

Although rChart can draw its data directly from text files and ODBC databases, the server component also allows you to feed in data programmatically - see the contents of the Samples\asp folder of the rChart installation.

Output from rChart Server

The server component can create output in one of two ways: to .swf files (in any context) or browser streaming (when used in asp only).

How rChart Server Can Be Used

Some of the ways rChart server can be used include:

 

Copyright © 2002 by rObjects. All rights reserved.