MultiBar, 3D-MultiBar, Area and Line Charts

MultiBar, 3D-MultiBar, Area and Line Charts:


MultiBar, 3D-MultiBar, Area and Line Charts
The MultiBar Chart, 3D-MultiBar Chart, Area Chart and Line Chart applets are similar to the Bar Chart and the Pie Chart applets, but they can represent more complex data. The class names for these charts are, respectively:
  • MultiBarChart.class
  • MultiBarChart3D.class
  • AreaChart.class
  • LineChart.class
You can use the same format as you would in the bar or pie charts for creating the applet tag, but there are some differences in the parameters.

Applet parameters

These record set parameters pass the data that will be represented in the chart:
In these parameters, GroupName1 is the name of the first group, ItemName1 is the name of the first item and ValueofItem1InGroup1 is its value in the first group (applets represent non-numeric values as 0 and negative values as positive).

Example for record set parameters

It is not necessary to have all the group-item combinations. As you can see in the example, there are no sales of Blend3 in Canada. The items in the groups don’t have to be in the same order in all groups (e.g., Blend2 and Blend3 in Mexico), however, it is necessary that all of the items in a group be together.
The applet automatically chooses colors for items (in the order red, blue, green, yellow, magenta, cyan, orange, pink, and dark gray). If you are using more than nine items, the tenth is darker red, the eleventh is darker blue, etc. Unlike the PieChart and BarChart applets, you cannot assign custom colors to the items in the charts.

Dynamic population of graph parameters

As with the other Graphlets, you can use a Cold Fusion template to generate the record set for a graph. Using the previous example, imagine you have a CoffeeSales table that stores information about revenues from sales of coffee blends by country. The query for retrieving the data from this table will look like this:
 
   SELECT Country, Blend, SUM(Revenues) 
   FROM CoffeeSales 
   GROUP BY Country, Blend 
The parameters definition will have the following form:
 
 

Optional parameters

The MultiBar Chart, 3D-MultiBar Chart, Area Chart and Line Chart applets use the same set of optional parameters for chart customization as the Pie Chart and Bar Chart applets with several additional parameters.
ParameterDescriptionDefault ValueNote
CumulativeCumulate the datanoAreaChart and LineChart only
DotSizeSize of the dots2LineChart only
RotationRotation angle (0-90)10MultiBarChart3D only
ElevationElevation angle (0-90)30MultiBarChart3D only
DistanceViewing distance in graph widths3MultiBarChart3D only

Data refresh

Like the other Graphlets, you can set these to refresh automatically. If you want to periodically refresh the data shown in the charts with a new set of data ,you can use two optional parameters: RefreshTime and RefreshDataFromURL. The URL must refer to a template or a static HTML page that returns the data in the following format:
Columns:Groups,Items,Values 
GroupName1,ItemName1,ValueOfItem1InGroup1 
... 
GroupName1,ItemNameN,ValueOfItemNInGroup1 
GroupName2,ItemName1,ValueOfItem1InGroup2 
...
GroupName2,ItemNameN,ValueOfItemNInGroup2 
...
GroupNameM,ItemName1,ValueOfItem1InGroupM
...
GroupNameM,ItemNameN,ValueOfItemNInGroupM
For example, you can create a Cold Fusion template called SalesMonitor.cfm to provide fresh data at regular 10 second intervals. In the applet you would include the following additional parameters:
In the SalesMonitor.cfm Cold Fusion template, you would simply include the query definition and the query output that would return the data in the format described above:
 
 
   SELECT Country, Blend, Revenues 
   FROM CoffeeSales 
   GROUP BY Country, Blend 

 
Columns:Groups,Items,Values 
 
 
   #Country#,#Blend#,#Revenues# 
 

留言

這個網誌中的熱門文章