Internet Vision Software
Index : Static and Dynamic Data Sources

../online_help/images/n_admin.gif

CFXGraphicsServer has 2 ways of obtaining its data. You can either give it a query from a live database, or you can specify data in the tag itself. To implement these two different ways of working there are 2 distinct classes of attribute, as well as a general class common to both Static(set in tag) and Dynamic(live) data

ST Class Attribute
An ST Class attribute specifies data to be displayed that is static, rather than from a database.

DB Class Attribute
A DB class attribute specifies a field, or group of fields from a database to be used in drawing a graph.

Other Attributes
These are non-data based attributes, for specifying preferences for Height, Width, Background Color etc.

DB and ST class attributes can be mixed within reason. The Data, X Positions and Z Positions must originate from the same source (e.g. Static or Dynamic), as must any Overlay data.

You could, for example, create a graph from dynamic data, and then use static data to supply error values.

So, you can make a graph from live or static data. We shall now have a look at an example of each:

Firstly, a graph from a live database:

In order to access a database in ColdFusion, we must first create a Query. A Query is simply a view on a database. A very simple example of this might be:

<CFQUERY NAME="MyQuery" DATASOURCE="MyDatabase">
SELECT data_Jan, data_Feb, links_Jan, links_Feb, labels
FROM SampleData
</CFQUERY>

Here we have selected the fields "data", "links" and "labels" from the "SampleData" table in "MyDatabase". The name of the query must be unique within the page.

We now create our tag:

<CFX_GraphicsServer QUERY="MyQuery" DB_DATASETS="data_Jan, data_Feb">

and this would give us a very basic graph displaying two data sets, "data_jan" and "data_feb". If we wanted to, we could elaborate on this somewhat. For example, we could add a hyperlinks on the graphical elements…

<CFX_GraphicsServer QUERY="MyQuery" DB_DATASETS="data_jan, data_feb" DB_URLSETS="links_jan, links_feb">

Then we might want to add legend entries for each set…

<CFX_GraphicsServer QUERY="MyQuery" DB_DATASETS="data_Jan, data_Feb" DB_URLSETS="links_Jan, links_Feb" SET_LEGENDENTRIES="January, February">

the possibilities are endless

We shall now look at an example of static data. This time we do not need to define a query, but just write a tag…

<CFX_GraphicsServer ST_DATASET0="1.0, 1.2, 1.6, 2.4"> ST_DATASET1="2.0, 2.1, 2.3, 2.7">

Note how when using static data, there is no need for field names, we just simply place the raw data in the tag. The ST_DATASETx (where x is the set number) is used to define the data. As you can see from the above tag, ST_DATASET0 defines the first data set, ST_DATASET1 the second and so on and so forth.

There are several ST class attributes that take multiple sets of data (e.g. ST_DATASET{0..}). This is denoted by at {0..} tagged onto the end of the attribute name and means "Replace by index of set, where the index is 0 for the first set, 1 for the second etc... .

Again, we can elaborate by adding more attributes to the tag, in fact, every DB class attribute has an equivalent ST class attribute and vice-versa.


Copyright 1999 Internet Vision Software Limited