public class NFBarchartApp extends Applet
This class supports the generation of barcharts consisting of 1 to 20 data sets, with any number of values assigned to each data set. Data sets can be displayed by grouping together corresponding bars, stacking them or display them in separate rows, and bars can be shown with or without a 3D effect. For every bar displayed, an optional active label can be displayed whenever the mouse cursor "dwells" over that bar. The text value displayed in that label can be specified directly or can be generated automatically from the value represented by that bar. Optionally, a URL can be assigned to that label to allow a "drill-down" to another HTML document or the output from a CGI command.
The following standard parameters are supported by this chart:
Background
Header HeaderBox Footer FooterBox LeftTitle LeftTitleBox RightTitle RightTitleBox
DwellLabel DwellBox ActiveClicks ActiveLabels[1-20]
Legend LegendBox LegendItems
TopAxis LeftAxis RightAxis BottomAxis
ColorTable
The following parameters are specifically supported by this chart:
GraphType = type;
Defines the type of graph to be displayed. The following types are supported:
GROUP - datasets are grouped together (default) ROWS - datasets are displayed in separate rows STACK - datasets are stacked
GraphLayout = type;
Defines the bargraph orientation. The following types are supported
HORIZONTAL - bars are oriented left to right. VERTICAL - bars are oriented bottom to top.
Note that the BarLabels resource will be displayed on the left axis for HORIZONTAL bargraphs and the bottom axis for VERTICAL bargraphs.
DataSets = (Name1, Color1), (Name2, Color2) ...;
Defines a list of datasets with the given name and color. The names will be used as items in the Legend, and the color will be used for each bar in the dataset. At most 20 datasets may be displayed.
If a color is not specified in the vector, then the previously specified color will be used. If the color is specified as "null", then a default color will be chosen from the color table. (See the ColorTable parameter.) Furthermore, if only a single data set is defined and no color value is assigned (or null is assigned) then EVERY bar in that data set will be given a different default color, depending on its position.
DataSet[1-20] = Number1, Number2, ...;
Defines a list of numeric values for each dataset defined by the DataSets parameter. Each dataset may contain a different number of values. If the value "null" is substituted for a Number, no bar will be drawn in that Number's position.
BarLabels = "String1", "String2", ...;
Defines a list of labels to be displayed below each group of bars.
Bar3DDepth = Number;
Defines the "depth" of the bar in pixels. A depth of 0 draws a 2D bar.
Grid = (LineColor, BGColor, BorderColor);
Defines the grid to be displayed behind the bars. If this parameter is not defined, no grid is displayed. If the BGColor is not defined, only grid lines are displayed.
The following HTML segment defines a bargraph containing two sets of bars, displayed in different rows.
<applet code=NFBarchartApp.class width=400 height=400> <param name=NFParamScript value = '
Background = (white, NONE, 4);
Header = ("This is a Demo\nWith A 2-Line Header"); HeaderBox = (lightGray, RAISED, 5);
Legend = ("Legend", black, "TimesRoman", 18); LegendBox = (lightGray, SHADOW, 5);
GraphType = ROWS; GraphLayout = VERTICAL;
DataSets = ("Set #1", blue), ("Set #2", red); DataSet1 = 100, 200, 300, 400, 200; DataSet2 = 40, 30, 20, 10, 500;
BarLabels = "Mon", "Tues", "Wed", "Thur", "Fri";
BottomTics = ("ON", black, "TimesRoman", 14);
LeftTics = ("ON", black, "Courier", 16); LeftScale = (0, 1000);
Grid = (black, lightGray, black);
DwellLabel = ("", black, "TimesRoman", 16); DwellBox = (cyan, SHADOW, 5);
ActiveLabels1 = ("8%", "DemoURL#firstPage", "NewWindow"), ("16%", "DemoURL#secondPage"), ("25%", "DemoURL#thirdPage"), ("33%", "AnotherURL"), ("16%", "");
'> </applet>