Chapter 3.
Using Perspective for Java
GETTING A CHART UP AND VIEWABLE
|
The method that you will use to display the chart will be different depending on the development environment: a Java Development Environment or HTML. |
|
In a Java Development Environment, use the procedures described in Chapter 2 to install the Perspective for Java bean into the JDE's component library. To get a chart up and viewable, simply create a new project applet window and drag the Perspective for Java bean from the component library to the new applet window. The default graph type (a vertical bar chart) using Perspective sample data will be displayed in the applet window. |
|
For HTML development, use one of the sample .HTML files provided in the samples section of the download page. These example .HTML files illustrate how to develop simple bar, bi-polar, and pie charts. Use the example files as a basis from which to develop your own .HTML files. |
|
Whether you use HTML or JAVA development depends on the development tools that you have or your system or intend to purchase for use with Perspective for Java. For HTML or JAVA development, you must use a Java 1.1 compliant browser for Java Development Environment (See Chapter 2 for details). See Chapter 4 for more information about the methods and properties that are available for HTML development. See Chapter 5 for more information about using Perspective for Java in a Java Development Environment. |
HOW PROPERTIES AND METHODS WORK
|
Properties can be used to assign a single value to a particular object or objects in a chart. All properties can be used as methods by assigning a "set" or "get" prefix to the property name. Most methods are overloaded and allow you to select an object in a chart by its Object ID, sequentially with an integer value, or according to the currently selected object. |
|
In either development environment (a JDE or Browser), use the GraphType property to select and display a particular chart type. Example: |
|
/* Set the graph type to Pie */ |
|
|
|
One of 94 different chart types can be selected. They are grouped in the following categories: |
|
GraphType Values |
Chart Category |
|
0...7, 9, 10, 12...14 |
3D |
|
17...23 |
Vertical Bar |
|
24...30 |
Horizontal Bar |
|
31...35 |
Vertical Area |
|
36...40 |
Horizontal Area |
|
55...60 & 93...94 |
Pie |
|
61...64 |
Scatter |
|
65...66 |
Polar |
|
67...69 |
Radar |
|
70...84 & 88 |
Stock |
|
85...82 |
Histograms |
|
87 |
Spectral Map |
|
90...92 |
Bubble Charts |
|
See Appendix A for a complete list of chart types and an illustration of each chart using sample data. |
|
These methods can be used to determine the chart type that is currently selected: |
|
|
|
isChart3DType(): This method returns a value of true or false indicating whether or not the GraphType property is currently set to a value in the range: 0...7, 9, 10, or 12...14 (a 3D chart). |
|
|
isChartBiPolar(): This method returns a value of true or false indicating whether or not the GraphType property is currently set to a bi-polar chart type (i.e., 21 (Vertical Bi-Polar Clustered Bars), 22 (Vertical Bi-Polar Stacked Bars), etc.). |
|
|
isChartBLAType(): This method returns a value of true or false indicating whether or not the GraphType property is currently set to a Bar, Line, or Area chart type (i.e., 17...54). |
|
|
isChartDualY(): This method returns a value of true or false indicating whether or not the GraphType property is currently set to a dual Y-axes chart type (e.g., 19 (Vertical Dual-Axis Clustered Bars), 20 (Vertical Dual-Axis Stacked Bars), etc.). |
|
|
isChartOrientHorz(): This method returns a value of true or false indicating whether or not the GraphType property is currently set to a horizontally-oriented chart type (e.g., 24 (Horizontal Clustered Bars), 25 (Horizontal Stacked Bars), etc.). |
|
|
isChartPieType(): This method returns a value of true or false indicating whether or not the GraphType property is currently set to a pie chart type (i.e., 55...60). |
|
|
isChartScatter(): This method returns a value of true or false indicating whether or not the GraphType property is currently set to a scatter chart type (i.e., 61...64). |
|
|
isChartStockType(): This method returns a value of true or false indicating whether or not the GraphType property is currently set to a stock chart type (i.e., 70...84 or 88). |
|
Unless otherwise specified, an internal set of default attributes/properties determines how a chart is initially imaged. |
|
When a chart is initially imaged, it is drawn using the Perspective minimum size (100, 100) -- approximately a 1-inch by 1-inch square. |
|
|
|
Perspective expects the programmer or the container's layout manager to use the standard JAVA setSize() and/or setBounds() methods to set the size required by the application or container in which it is used. This allows the Perspective component to be instantiated and mixed with other components without disrupting the sizing issues required by the container or other components within the container. |
|
You can use the Perspective getMinimumSize() method to determine the minimum size of Perspective. |
|
For all 3D charts, the graph is imaged using Viewing3DAnglePreset set to one (standard). This images the chart with the labels for the ordinal axes (O1 (Groups) and O2 (Series)) on the bottom of the chart and labels for the numeric (Y1) axis on the left side as shown in the following illustration: |
|
|
|
For single axis, vertical charts, the default attributes image the ordinal (O1) axis on the bottom of the chart and numeric (Y1) axis on the left side chart. The series labels are drawn in the legend area at the bottom of the chart as shown in the following illustration: |
|
|
|
For all vertical and horizontal charts, automatic shading of risers and a 2.5 effect (DepthRadius and DepthThickness) is applied to the graph. |
|
For single axis, horizontal charts, the default attributes image the ordinal (O1) axis on the left side of the chart and numeric (Y1) axis on the bottom side of the chart as shown in the following illustration: |
|
|
Dual-Axes and Bi-Polar Vertical Charts
|
For dual axes and bipolar vertical charts, the Y1 axis is imaged on the left side of the chart and the Y2 axis is drawn on the right side as shown in the following illustration: |
|
|
Dual-Axes and Bi-Polar Horizontal Charts
|
For dual axes and bipolar horizontal charts, the Y1 axis is drawn on the bottom of the chart and the Y2 axis is imaged on the top chart as shown in the following illustration: |
|
|
|
A dual-axes line is drawn dividing the two halves of the chart. The default dual-axes split position is 50. |
Pie charts are drawn with pie feelers and labels, the PieDepth set to 30, and the PieTitle set to 10. If a multiple pie graph type is used, the chart is imaged with two pies per row. The pie feeler text format is set to zero (standard) so that the actual value that make of the pie slice is displayed. All groups in a series are combined to form a single pie slice. |
|
|
|
The chart legend area at the bottom of the chart shows the series labels. |
|
When GraphType(93) is selected, Perspective maps the series in the pie chart to a bar showing the values associated with each wedge: |
|
| |
You can use the PieBarSeries property to select the series in the pie chart that will be used to map the bar. The default pie bar series is zero. |
|
For scatter charts, the X1 axis is drawn on the bottom of the chart and the Y1 axis is drawn on the left side of the chart. If a dual axes scatter chart is selected, the Y2 axis is drawn on the right side of the chart: |
|
|
|
The High/Low Stock, Candle graph is a "Japanese" style stock chart. Risers are defined by open and close values. Ticks poke out from the top and bottom for high and low values. The bars will be one color if the close value is greater than the open value. Another color is used if the open value is greater than the close. |
|
|
|
In stock charts, green risers show high values and blue risers show low values. If single axis stock charts, the Y1 axis is drawn on the left side of the chart and the O1 axis is drawn on the bottom of the chart. For dual-axes and bi-polar stock charts, the Y1 axis is drawn on the left and the Y2 axis is drawn on the right side. |
|
|
|
If close values are included in the chart, a line is drawn in the riser at the close value. If volume values are included, the volumes are shown in the bottom of the chart on the Y2 axis and high, low, open, and/or close values are shown in the top of the chart. |
|
The vertical histogram is drawn with the X1 axis at the bottom of the chart and the Y1 axis on the left side as shown in the following illustration. If a horizontal histogram is used, the Y1 axis is drawn at the bottom of the chart and the X1 axis along the left side. |
|
|
|
The spectral map chart type is a row or column matrix of markers that are colored according to data values. The default chart with sample data draws the O2 (series) axis labels on the left side of the chart and the O1 (group) axis labels at the bottom of the chart as shown in the following illustration: |
|
|
|
In a Spectral Map, the risers are colored by height (rather than by series or by group). The charting engine chooses the color of quantative data representations based on the data values supplied to the chart. You can use the getColorByHeight() and gradient methods to modify the gradient. |
|
Perspective includes four types of bubble charts: Single axis chart with and without labels and Dual axes chart with and without labels. In the default configuration the Y1 axis labels are drawn on the left side of the chart and the X1 axis labels are drawn at the bottom of the chart. Three quadrant lines are drawn for the Y1 axis and two quadrant lines are drawn for the X1 axis as shown in the following illustration: |
|
|
|
All charts are drawn using a virtual coordinate system. Regardless of the type of screen or printer device, the chart is created using the virtual coordinate system. The following illustration is a diagram of the virtual coordinates system: |
|
|
|
The virtual coordinates are converted to device coordinates when an object is drawn on the device. Some objects in a chart can be resized and relocated using setRect() method. The size of some objects in a chart are calculated at run-time by the charting engine and cannot be changed. |
|
These properties and methods control the overall appearance and look of the chart: |
|
|
|
BiDirectional (true/false) |
|
|
GraphType (0...93) |
|
|
ManualRedraw (true/false) |
|
|
UseSampleData (true/false) |
|
|
UseOffScreen (true/false) |
|
The BiDirectional property reverses the text alignment of all objects and the location of legend text next to label markers. This property is provided for international support ONLY! It can be used to make the entire chart read from right-to-left (BiDirectional(true)) or left-to-right (BiDirectional(false)). However, note that BiDirectional(true) does not reverse the values of the associated properties and methods. They retain their original values. For example, getTextJustHoriz() would return zero (left) even though visually the text is aligned right by BiDirectional(true). Use this property with great care! Your application must keep track of the BiDirectional setting and handle the reverse values supplied by associated properties and methods. |
|
|
The GraphType property selects the type of graph (e.g, 3D, Vertical Bar, Pie, Stock, etc.) to be drawn. Appendix A includes an example of each of the 93 graph types that Perspective supports. |
|
|
The ManualRedraw property enables (true) / disables (false) manual redrawing of the chart when the chart properties/attributes are changed. The default value is false so that the chart is always automatically redrawn when chart properties change. |
|
|
The UseSampleData property enables (true) / disables (false) the use of a sample data in a chart. Different sets of data are included in TDGDataSampler.class for use with the various graph types. This data can be used to show how various graph types are imaged using typical data that might be included in the chart. See " The Data Interface" for methods that can be used to import your own data in a chart. Chapter 6 contains additional information about including your own data in a chart. |
|
|
The UseOffScreen property controls whether the chart will be drawn directly to the graphics device (true) or using an off-screen image buffer (false). Set this property to false when the drawing speed of the chart seems very slow. When this property is set to false, it can increase the drawing speed by a factor of three in some situations. |
|
The chart frame is the outer edge of the chart on which gridlines and risers (bar, area, markers) are drawn. |
|
|
|
|
|
These properties and methods define how the chart frame is imaged: |
|
|
|
FrameDisplay (True/False) |
|
|
DepthAngle (0...360) |
|
|
DepthRadius (0...100) |
|
The FrameDisplay property enables (true)/disables (false) display of the chart frame text string. The default value is True. |
|
|
To draw a chart frame with a 2.5D effect as shown in this example, use the DepthAngle and Depth Radius properties to set the angle and radius of the 2.5D effect. This example chart frame was drawn with the default values DepthAngle(45) and DepthRadius(25). |
Depending on the graph type, the chart may include one or two ordinal axes (O1 and O2) and up to three numeric axes (X1, Y1, Y2). The following illustration shows a chart with one ordinal axis (O1) and two numeric axes (Y1 and Y2). Note that the secondary ordinal axis (O2) only appears in 3D charts. |
|
|
|
An O1 (group or category) axis is included in all chart types except bubble, histogram and scatter charts. An O2 (series) axis is only included in 3D charts. An X1 axis is only included in bubble, histogram, and scatter charts. A Y1 axis is included in all chart types except pies. A Y2 axis is only included in dual-axes charts. An X1 axis is only included in bubble, histogram and scatter charts. The following table shows the default values for properties that affect these axes and their grid lines, labels, titles, etc. Blank cells indicate the property is not supported or applicable for the axis: |
Property |
O1 Axis |
O2 Axis (3D Charts and Spectral Map Only)* |
X1 Axis |
Y1 Axis |
Y2 Axis |
|
AxisDescending |
|
|
false |
false |
false |
|
AxisLineDisplay |
true |
|
true |
true |
true |
|
AxisSide |
0 |
|
0 |
0 |
1 |
|
ExcludeMaxLabel |
false |
false |
false |
false |
false |
|
ExcludeMinLabel |
false |
false |
false |
false |
false |
|
LabelAutofit |
true |
true |
true |
false |
true |
|
LabelAutoskip |
0 |
|
|
|
|
|
LabelDisplay |
true |
true |
true |
true |
true |
|
LabelFormat |
|
|
0 |
0 |
0 |
|
LabelFormatPattern |
|
|
"#.#" |
"#.#" |
"#.#" |
|
LabelMargin |
0 |
|
|
|
|
|
LabelRotate |
0 |
0 |
0 |
0 |
0 |
|
LabelSkipBegin |
0 |
|
|
|
|
|
LabelSkipCount |
0 |
|
|
|
|
|
LabelStagger |
false |
|
false |
false |
false |
|
LogScale |
|
|
false |
false |
false |
|
LabelWrap |
false |
false |
|
|
|
|
MajorGridDisplay |
true |
* |
true |
true |
true |
|
MajorGridStep |
|
|
10.0 |
10.0 |
10.0 |
|
MajorGridStepAuto |
|
|
true |
true |
true |
|
MajorGridStyle |
0 |
|
0 |
0 |
0 |
|
MinorGridCount |
1 |
|
|
|
|
|
MinorGridDisplay |
false |
|
false |
false |
false |
|
MinorGridStep |
|
|
10.0 |
10.0 |
10.0 |
|
MinorGridStepAuto |
|
|
true |
true |
true |
|
MinorGridStyle |
0 |
|
0 |
0 |
0 |
|
MustIncludeZero |
|
|
false |
false |
false |
|
OffScaleDisplay |
|
|
true |
true |
true |
|
ScaleMax |
|
|
100.0 |
70.0 |
80.0 |
|
ScaleMaxAuto |
|
|
true |
true |
true |
|
ScaleMin |
|
|
0.0 |
0.0 |
0.0 |
|
ScaleMinAuto |
|
|
true |
true |
true |
|
TitleAutofit |
true |
true |
true |
true |
true |
|
TitleDisplay |
false |
false |
false |
false |
false |
|
TitleString |
Null String |
Null String |
Null String |
Null String |
Null String |
|
* |
Grid3DFloorDisplayX/Z, Grid3DLeftWallDisplayY/Z, Grid3DRightWallDisplayX/Y, and Grid3DRiserDisplayX/Y/Z enable/disable the display of grid lines in a 3D chart. |
|
Use these properties to define how ordinal axis are imaged in the chart: |
|
|
|
O1AxisLineDisplay (true/false): This property enables (true) / disables (false) the display of the base line on the primary ordinal axis. |
|
|
O1AxisSide (0...3): This property controls which side of the graph the ordinal axis is imaged. Although the vast majority of all graphs will image their ordinal text on the bottom of a vertical chart or left of a horizontal chart, it is possible to image it to the top/right or both sides. The default value is 1 (bottom for vertical charts/left for horizontal charts). |
|
Also see " Labels and Titles" and "Grid Lines" for additional information about how to control the display of labels and titles on an ordinal axis. |
|
Use these methods to determine if the chart includes the primary or secondary ordinal axis: |
|
|
|
isO1AxisPresent(): This method returns true or false indicating whether or not the primary ordinal axis is present in the chart. |
|
|
isO2AxisPresent():This method returns true or false indicating whether or not the secondary ordinal axis is present in the chart. |
|
These properties indicate whether or not the axis is present regardless of whether or not the axis base line is enabled for display. The primary ordinal axis is present in most graph types. The secondary ordinal axis is only present in 3D graph types. |
|
Use these properties to define how numeric axes are imaged in the chart: |
|
|
|
X1/Y1/Y2AxisDescending (True/False) |
|
|
X1/Y1/Y2AxisLineDisplay (true/false) |
|
|
X1/Y1/Y2AxisSide (0...2) |
|
|
X1/Y1/Y2OffScaleDisplay (True/False) |
|
|
X1/Y1/Y2LogScale (True/False) |
|
|
X1/Y1/Y2ScaleMax (Double) |
|
|
X1/Y1/Y2ScaleMaxAuto (True/False) |
|
|
X1/Y1/Y2ScaleMin (Double) |
|
|
X1/Y1/Y2ScaleMinAuto (True/False) |
|
|
X1/Y1ZeroLineDisplay (True/False) |
|
|
X1/Y1/Y2MustIncludeZero (True/False) |
|
Use the AxisDescending properties to change the direction of values displayed on the axis to descending or ascending. The default value is True (ascending values). |
|
|
The AxisLineDisplay properties enable (true) / disable (false) the display of the bottom line on an axis. |
|
|
The AxisSide properties control the side of the chart where the axis is imaged. For vertical charts, the default settings draw the Y1 axis on the left side of the chart and the Y2 on the right. For horizontal charts, Y1 is drawn on the bottom of the chart and Y2 on the top. |
|
|
The LogScale properties specify the scale (logarithmic or linear) for the numeric axis. The default value is False (linear). |
|
|
The OffScaleDisplay properties determine whether or not values out of range are imaged on the axis. |
|
|
The ScaleMin and ScaleMax properties define the range (minimum and maximum) of values that will be imaged on the axis. The ScaleMinAuto and ScaleMaxAuto properties tell the charting engine to automatically calculate the minimum and maximum values. If these properties are enabled (set true), values set by ScaleMin and ScaleMax are ignored. |
|
|
The ZeroLineDisplay properties enable/disable drawing of a zero line on an axis. The default value is true (the zero line is drawn). |
|
|
The MustIncludeZero properties determine whether or not the numeric axes includes zero. The default value is false. |
|
|
Also see " Labels and Titles" for additional information about how to control the display of labels and titles on a numeric axis. |
Use these methods to get information about specific numeric axes in a chart: |
||
|
getX1MajorGridStepAutoValue(); If major grid steps are automatically calculated, this method returns the grid step value for the X-axis. |
|
|
getX1ScaleMaxAutoValue(); If the maximum scale value is automatically calculated, this method returns the maximum scaling value that will be used on the X-axis. |
|
|
getX1ScaleMinAutoValue(); If the minimum scale value is automatically calculated, this method returns the minimum scaling value that will be used on the X-axis. |
|
|
getY1MajorGridStepAutoValue(); If major grid steps are automatically calculated, this method returns the grid step value for the Y1-axis. |
|
|
getY1ScaleMaxAutoValue(); If the maximum scale value is automatically calculated, this method returns the maximum scaling value that will be used on the Y1-axis. |
|
|
getY1ScaleMinAutoValue(); If the minimum scale value is automatically calculated, this method returns the minimum scaling value that will be used on the Y1-axis. |
|
|
getY2MajorGridStepAutoValue(); If major grid steps are automatically calculated, this method returns the grid step value for the Y2-axis. |
|
|
getY2ScaleMaxAutoValue(); If the maximum scale value is automatically calculated, this method returns the maximum scaling value that will be used on the Y2-axis. |
|
|
getY2ScaleMinAutoValue(); If the minimum scale value is automatically calculated, this method returns the minimum scaling value that will be used on the Y2-axis. |
|
|
isX1AxisPresent(); This method returns true or false indicating whether or not the X-axis is prsent in the chart. |
|
|
isY1AxisPresent();This method returns true or false indicating whether or not the primary numeric axis is prsent in the chart. |
|
|
isY2AxisPresent();This method returns true or false indicating whether or not the secondary numeric axis is prsent in the chart. |
|
|
isZ1AxisPresent();This method returns true or false indicating whether or not the Z-axis is prsent in the chart. |
|
These properties indicate whether or not the axis is present regardless of whether or not the axis base line is enabled for display. The X1-axis is present in scatter charts, bubble charts, histograms, etc. The Y1-axis is present in most graph types. The Y2-axis is only present in dual-axes charts. |
|
In addition to the axis-specific properties and methods described above, these methods can be used to get and set axis attributes. |
|
|
|
get/setAxisAssignment(); Get/set the axis assignment to determine where a series is assigned to an axis. |
|
|
get/setAxisDescending(); Get/set the order (ascending or descending) in which an axis is drawn. |
|
|
get/setAxisSide(); Get/set the side of the chart where an axis is imaged. |
|
|
get/setDisplayOffscale(); Get/set whether or not off-scale values are drawn on an axis. |
|
|
get/setLogScale(); Get/set whether the axis uses linear or logarithmic scaling |
|
|
get/setLogScaleBase(); Get/set the scale base when logarithmic scaling is used on a numeric axis. |
|
|
get/setScaleMax; Get/set the maximum value imaged on an axis. |
|
|
get/setScaleMaxAuto(); Get/set automatic calculation of the ScaleMax value. |
|
|
get/setScaleMin(); Get/set the minimum value imaged on an axis. |
|
|
get/setScaleMinAuto();Get/set automatic calculation of the ScaleMin value. |
|
|
get/setScaleMustIncludeZero(); Get/set whether or not the axis must include a zero value. |
|
When these methods are used, the object ID of an axis may be supplied as an input parameter to identify the axis where the attribute is applied. See " Getting an Object ID" for methods that can be used to get an object ID. If an axis is not specified, the attribute is retrieved from or assigned to the first item in the selection list. If the object ID does not identify an axis or the first item in the selection list is not an axis, a "set" operation will apply the attribute to the object but it will not effect the appearance of the chart. |
Properties for Dual Axes Charts
|
These properties control the axes in dual-axes charts: |
|
|
|
DualAxisLineDisplay (True/False); This property enables (true) / disables (false) the display of a line that separates the two halves of a dual axes chart. |
|
|
DualAxisSplitPosition (0...100); This property sets the position within the chart frame where the Dual-Y split position will be created. |
|
Use these methods to define how axis text is autofitted: |
|
|
|
AxisTextAutofitMax ( value ); This property defines the maximum size of axis text in virtual coordinates. |
|
|
AxisTextAutofitMin ( value ); This property defines the minimum size of axis text in virtual coordinates. |
|
|
AxisTextAutofitMode ( 0...2 ); This property defines the mode to be used for autofitting axis text. |
|
|
AxisTextAutofitPercent ( 0...100% ); When AxisTextAutofitMode is set to two, this property defines the percent to be used for autofitting axis text. All Axis text is maintained within AxisTextAutofitPercent of the axis with the smallest font size as determined by Autofit. |
|
Each axis in a chart can include or exclude major and minor grid lines. Properties and methods also allow you to specify the number and style of grid lines displayed on each axis. The following illustration shows a bi-polar chart where major and minor grid lines have been enabled on the ordinal (O1) axis and both numeric (Y1 and Y2) axes: |
|
|
Use these properties to control the grid lines on the ordinal axis: |
||
|
O1MajorGridDisplay (True/False) |
|
|
O1MajorGridStyle (0...5) |
|
|
O1MinorGridCount (0...50) |
|
|
O1MinorGridDisplay (True/False) |
|
|
O1MinorGridStyle (0...5) |
|
These properties control the number, display, and style of ordinal axis major and minor grid lines. Major and minor grid lines can be displayed in one of the following styles: |
||
0= |
No grid lines |
|
1= |
Normal grid lines, height of frame |
|
2= |
Normal grid lines extended beyond the height of frame |
|
3= |
Small tick marks from frame edge inward |
|
4= |
Small tick marks from frame edge outward |
|
5= |
Ticks span across the frame edge |
|
All charts can include major and minor grid lines. In the default configuration, major grid lines are drawn and minor grid lines are not drawn. When both grid lines are displayed, different styles can be assigned to major and minor grid lines so that they are easily distinguished in the chart. |
|
Use these methods to control the appearance of grid lines on the numeric axes (X1, Y2, and Y2) in a chart. |
|
|
|
X1/Y1/Y2MajorGridDisplay (True/False) |
|
|
X1/Y1/Y2MajorGridStyle (0...5) |
|
|
X1/Y2/Y2MajorGridStep (double) |
|
|
X1/Y1/Y2MajorGridStepAuto (true/false) |
|
|
X1/Y1/Y2MinorGridDisplay (True/False) |
|
|
X1/Y1/Y2MinorGridStyle (0...5) |
|
|
X1/Y1/Y2MinorGridStep(double) |
|
|
X1/Y1/Y2MinorGridStepAuto (true/false) |
|
The GridDisplay properties control the display of major and minor grid lines on a numeric axes. The default value is true for major grid lines and false for minor grid lines. The GridStyle properties select the style of numeric axes major and minor grid lines: |
|
|
0= |
No grid lines |
|
1= |
Normal grid lines, height of frame |
|
2= |
Normal grid lines extended beyond the height of frame |
|
3= |
Small tick marks from frame edge inward |
|
4= |
Small tick marks from frame edge outward |
|
5= |
Ticks span across the frame edge |
|
Typically different styles are used for major and minor grid lines so that they are easily distinguished in the chart. |
|
|
The GridStep and GridStepAuto properties control the number of numeric axis grid lines according to the number of values displayed on an axis. If the GridStepAuto property is enabled, the number of grid steps is automatically calculated and the value assigned to the associated GridStep property will be ignored. If the GridStepAuto property is disabled, the GridStep property controls the number of major or minor grid lines that will be imaged. For example, grid steps 1, 6, 11, 16, ...51 will be imaged if the range of values in the chart is 1...51 and this property is set to 5. If this property is set to 10, grid steps 1, 11, 21, 31...51 would be displayed. |
|
Grid lines can be displayed on the floor and walls of the cube in 3D graphs as shown in the following illustration: |
|
|
|
|
|
Use the following properties to enable and disable these grid lines: |
|
|
|
Grid3DFloorDisplayX/Z (True/False): These properties enable/disable the display of X-axis and Z-axis grid lines on the floor of the cube. |
|
|
Grid3DLeftWallDisplayY/Z (True/False): These properties enable/disable the display of Y- and Z-axis grid lines on the left wall of the cube. |
|
|
Grid3DRightWallDisplayX/Y (True/False): These properties enable/disable the display of X- and Y-axis grid lines on the right wall of the cube. |
|
Grids can also be displayed on risers in 3D graphs using these properties: |
|
|
|
Grid3DRiserDisplayX (True/False): This property enables/disables the display of X-axis grid lines on risers in a 3D-surface chart. It is only applicable when a 3D-surface chart is selected. |
|
|
Grid3DRiserDisplayY (True/False): This property enables/disables the display of Y-axis grid lines on risers in a 3D chart. |
|
|
Grid3DRiserDisplayZ (True/False): This property enables/disables the display of Z-axis grid lines on risers in a 3D-surface chart. It is only applicable when a 3D-surface chart is selected. |
Axis Independent Methods for Grids
|
In addition to the axis-specific grid properties described above, these methods can be used to get and set grid attributes. |
|
|
|
get/setGridCount(): Get/set the number of grid lines on an axis. |
|
|
get/setGridStep(): Get/set the number of grid steps on an axis |
|
|
get/setGridStepAuto(): Get/set whether grid steps are automatically calculated on an axis. |
|
|
get/setGridStyle(): Get/set the style of grid lines to be imaged on an axis |
|
When these methods are used, the object ID of a grid may be supplied as an input parameter to identify the grid to which the attribute is applied. See " Getting an Object ID" for the methods that can be used to get the object ID of a grid. If a grid is not specified, the attribute is retrieved from or assigned to the first item in the selection list. If the object ID does not identify a grid object or the first item in the selection list is not an grid object, a "set" operation will apply the attribute to the object but it will not have any effect on the appearance of the chart. |
Perspective includes in the following properties and methods for drawing curve fit lines across one or more series of risers in a chart: |
||
|
get/setCurveFitType(); These methods get and set a curve fit type (e.g., linear, quadratic, polynomial, etc.). The setCurveFitType() method enables drawing of the curve fit line. |
|
|
get/setCurveFitPolynomialOrder(); If setCurveFitType() selects a polynomial fit line, these methods get and set order for the polynomial fit. |
|
|
CurveFitEquationDisplay; This property enables / disables drawing of the equation associated with a curve fit line. |
|
|
CurveFitHighOrderFirst; When the CurveFitEquationDisplay property is true, this property selects the format of the equation. |
|
|
CurveFitNumSegments; This property defines the number of segments to use in drawing a curve fit line. |
|
The risers and markers in a chart are initially determined by the graph type that is selected with the GraphType property. For example, GraphType 17 selects a vertical bar chart and the risers are drawn in the chart as vertical bars that are auto-shaded and imaged with a 2.5D effect by default. GraphType 54 selects a horizontal line chart in which risers are drawn as lines that are auto-shaded and imaged with a 2.5D effect by default. |
|
|
|
The following properties and methods can be used to change how risers and markers are imaged in the chart. Also see " Pie Chart Properties and Methods" and "Stock Chart Characteristics" for more information about the risers and markers in these graph types. |
|
These properties control risers and markers in a chart: |
|
|
|
ConnectLineMarkers (True/False) |
|
|
ConnectScatterMarkers (True/False) |
|
|
CubeSquareRisers (True/False) |
|
|
DataLineThickness (1...100) |
|
|
DisplayBarAsPictograph (True/False) |
|
|
MarkerDisplay (True/False) |
|
|
MarkerSizeDefault (0...100) |
|
|
ReverseGroups (True/False) |
|
|
ReverseSeries (True/False) |
|
|
Riser3DThicknessY (0...100) |
|
|
RiserBarGroupSpacing (0...100) |
|
|
RiserBorderMode (0...2) |
|
|
RiserWidth (0...100) |
|
|
ScaleFromZero (True/False) |
|
|
SeriesDefaultBorderColor(color) |
|
|
SeriesDefaultTransparentBorderColor(True/False) |
|
|
SeriesAreRows (True/False) |
|
|
UseSeriesBorderDefaults(True/False) |
|
If you want the risers/markers in a chart to always be square regardless of the shape and size of a 3D cube (for example), use the CubeSquareRisers property. |
|
|
In line charts where a 2.5D effect is not applied to the chart, the line risers are displayed as markers. Use the ConnectLineMarkers property to enable (true) / disable (false) the display of a line that connects the markers. |
|
|
In a Scatter chart, use the ConnectScatterMarkers property to enable (true) / disable (false) the display of connecting lines between markers. |
|
|
When lines are drawn between markers in a line or scatter chart, you may use the MarkerDisplay property to remove the markers from the chart and only display the connecting lines. |
|
|
For a "2.5D effect" chart, the DataLineThickness property defines the thickness (in pixels) of the "fake 3D" line. |
|
|
When a texture file has been loaded using setTextureURL(), the DisplayBarAsPictograph property can be used to enable the texture file image on bar risers. |
|
|
Use the MarkerSizeDefault property to define the default size of markers in a 2D chart. See the get/setMarkerSize methods if you want to change the size of markers. |
|
|
The Riser3DThicknessY, RiserWidth, and RiserBarGroupSpacing properties can be used to control the size of bar risers in 3D and 2D charts. |
|
|
The RiserBorderMode property determine when riser borders are drawn (always, never, or only for small datasets (fewer than 900 risers)). |
|
|
In applications where the data range can include negative numbers, the ScaleFromZero property determines whether the risers will be drawn pointing up and down from a zero line or whether all risers will draw straight up from the "bottom" of the graph. |
|
|
The ReverseGroups, ReverseSeries, and SeriesAreRows properties can be used to control how data is assigned to risers and markers in a chart. |
|
|
When UseSeriesBorderDefaults is enabled (true), riser borders will be drawn with the color defined with the SeriesDefaultBorderColor property if SeriesDefaultTransparentBorderColor is false. If SeriesDefaultTransparentBorderColor is true and UseSeriesBorderDefault is enabled, transparent borders are drawn around riser edges. |
|
In addition to the riser-specific properties described above, these methods can be used to get and set riser and marker attributes. |
|
|
|
get/setMarkerShape(): Get/set the shape of markers in a series. |
|
|
get/setMarkerSize(): Get/set the size of markers in a series or series and group |
|
The setMarkerShape() method can be used to set the shape of individual series of markers/risers in a chart. This allows you to use a different type of risers for series in a chart. For example, series one could use bar risers, series two could use line markers, and series three could use area risers. |
|
|
When these methods are used, the object ID of a riser/marker may be supplied as an input parameter to identify the object to which the attribute is applied. See " Getting an Object ID" for the methods that can be used to get the object ID of markers and risers. If a riser or marker is not specified, the attribute is retrieved from or assigned to the first item in the selection list. If the object ID does not identify a riser or marker object or the first item in the selection list is not a riser or marker object, a "set" operation will apply the attribute to the object but it will not have any effect on the appearance of the chart. |
|
The following methods support custom marker shapes: |
|
|
|
registerMarkerTemplate(): Register a user-defined marker. |
|
|
setMarkerTemplate(): Assign the user-defined marker to a marker template slot. |
|
|
getNextMarkerTemplateSlot(): Determine which marker is in each template slot. |
|
In addition to the marker shapes that are provided with Perspective, you may also define your own custom marker shapes. Perspective provides the following marker shapes that can be set with setMarkerShape(): 1) Square, 2) Circle, 3) Diamond, 4) Plus, 5) Triangle-Up, and 6) Triangle-Down. Perspective supports up to 32 marker shapes. You may over-write any of the predefined marker shapes in template slots 1-6 or define new shapes in slots 7-32. Use the following procedures: |
|
|
1. |
Define the shape, typically as a standard Java Polygon. The polygon must fit in the rectangle: -900, -900, 1800, 1800 (i.e., the rectangle that goes from -900 to 900 in the X- and Y-directions). These are Perspective virtual coordinates. |
|
2. |
Register the polygon with Perspective with the following method: |
|
|
int nNewShape = |
|
|
Where: m_chart = the Perspective instance the caller uses to access Perspective properties and methods. |
|
3. |
Use the marker shape number (e.g., nNewShape) returned by registerMarkerTemplate() as the input parameter to setMarkerShape. Example: |
|
|
perspective1.setMarkerShape ( perspective1.getSeries(1),nNewShape); |
|
4. |
Perspective currently supports 32 marker shapes. It is possible to overwrite any or all of these using the following method: |
|
|
setMarkerTemplate (int nIndex, Polygon newPolygon); |
|
5. |
You may use the following method to determine which marker shapes are assigned to each marker template slot: |
|
|
getNextMarkerTemplateSlot (); |
|
The following methods can be used to define the use of exceptional/highlighted risers in a chart. |
|
|
|
get/setExceptionalRiser(): These methods get and set exceptional risers at a particular series and group. |
|
|
getExceptionalRisers(): This method can be used to determine if there are any exceptional risers in a chart. |
|
|
isExceptionalAllowed(): This method can be used to determine if exceptional risers are allowed in a chart. |
|
|
setNoExceptionalRiser(): This method can be used to disallow exceptional risers in a chart. |
|
The following properties and methods control chart legends. |
|
These properties are used to control how the legend area, legend markers, and legend text are imaged in a chart: |
|
|
|
LegendAutomatic (True/False): This property enables/disables auto-fitting of text inside the legend box. The default value is True. |
|
|
LegendDisplay (True/False): This property enables/disables drawing of the legend box. The default value is True. |
|
|
LegendMarkerPosition (0...4): This property sets the location and format of the chart legends. The default value is 0. |
|
|
LegendTextAutofit (True/False): This property enables (true) / disables (false) auto-fitting of the legend text. The default value is True. |
|
|
UseSeriesShapes (True/False): This property enables/disables the use of the shapes defined by the setMarkerShape() method. This property is ignored if the LegendMarkerPosition property sets the legend text to display on top of the legend marker. |
|
|
|
|
|
SquareMarkers (True/False): This property can be used to force markers in the legend area to fit in a perfectly square rectangle regardless of their shape. This property is ignored if the LegendMarkerPosition property sets the legend text to display on top of the legend marker. |
|
These methods are used to control how the legend area, legend markers, and legend text are imaged in a chart: |
|
|
|
setLegendOrient(int newValue): This method is used to set the orientation of the legends in a chart. |
|
|
getLegendMinWidth (): This method allows a user to resize the legend so that none of the labels wrap or truncate. Note that since it specifically calculates wdith, it is applicable to Vertical legends only! |
|
|
get/setLegendRect(): These methods are used to get/set the size and location of the legend rectangle. Also see "Virtual Coordinates" for additional information about the virtual coordinates system. |
|
|
setLegendTextAutofit(boolean newValue): This method is used to enable (true) / disable (false) auto-fitting of the legend text. |
|
The titles and labels that are included in the chart consist of the chart-wide titles (footnote, title, and subtitle) and ordinal and numeric axis labels and titles. All labels and titles can be defined, displayed, and auto-fitted using the properties and methods described below. |
|
These properties are used to define, display, and auto-fit the chart title, subtitle, and footnote. |
|
|
|
FootnoteAutofit(true/false) |
|
|
FootnoteDisplay(true/false) |
|
|
FootnoteString (String) |
|
|
SubtitleAutofit(true/false) |
|
|
SubtitleDisplay(true/false) |
|
|
SubtitleString (string) |
|
|
TitleAutofit (true/false) |
|
|
TitleDisplay (true/false) |
|
|
TitleString (string) |
Ordinal Axis Labels and Titles
|
These properties can be used to control the appearance of labels and titles on an ordinal axis: |
|
|
|
O1/O2ExcludeMaxLabel(true/false) |
|
|
O1/O2ExcludeMinLabel(true/false) |
|
|
O1/O2LabelAutofit (true/false) |
|
|
O1LabelAutoskip (0...2) |
|
|
O1/O2LabelDisplay (true/false) |
|
|
O1/O2LabelRotate (0...2) |
|
|
O1LabelStagger(true/false) |
|
|
O1/O2LabelWrap (true/false) |
|
|
O1LabelSkipBegin (value) |
|
|
O1LabelSkipCount (value) |
|
|
O1/O2TitleAutofit (true/false) |
|
|
O1/O2TitleDisplay (true/false) |
|
|
O1/O2TitleString (String) |
|
The ExcludeMinLabel and ExcludeMaxLabel properties can be used to include/exclude the minimum and maximum labels on the ordinal axis. |
|
|
The LabelDisplay and LabelAutofit properties determine whether labels are displayed and auto-fitted on the ordinal axis. See " Label and Title Methods" for methods that can be used to define ordinal axis labels. |
|
|
The LabelRotate, LabelStagger, and LabelWrap properties can be used to control how labels are imaged on the ordinal axis. |
|
|
LabelAutoSkip , LabelSkipBegin, and LabelSkipCount properties can be used to omit some of the labels on the O1-axis. When LabelAutoSkip selects manual skip mode, LabelSkipBegin and LabelSkipCount properties define the beginning label and interval of labels to be omitted. When LabelAutoSkip selects automatic label skip mode, Perspective will omit labels as necessary when the chart is made smaller in order to maintain a reasonable, readable label size (a minimum 8-point font size). |
|
|
The TitleAutofit, TitleDisplay, and TitleString properties are used to define, display, and auto-fit the title on an ordinal axis. |
Numeric Axis Labels and Titles
|
These properties control the appearance of labels and titles on a numeric axis: |
|
|
|
X1/Y1/Y2ExcludeMaxLabel(true/false) |
|
|
X1/Y1/Y2ExcludeMinLabel (true/false) |
|
|
X1/Y1/Y2LabelAutofit (true/false) |
|
|
X1/Y1/Y2LabelDisplay (True/False) |
|
|
X1/Y1/Y2LabelRotate (0...2) |
|
|
X1/Y1/Y2LabelStagger (True/False) |
|
|
X1/Y1/Y2TitleAutofit (True/False) |
|
|
X1/Y1/Y2TitleDisplay (True/False) |
|
|
X1/Y1/Y2TitleString (String) |
|
The ExcludeMinLabel and ExcludeMaxLabel properties can be used to include/exclude the minimum and maximum labels on a numeric axis. |
|
|
The LabelDisplay and LabelAutofit properties determine whether labels are displayed and auto-fitted on a numeric axis. |
|
|
The LabelRotate and LabelStagger properties can be used to control how labels are imaged on a numeric axis. |
|
|
The TitleAutofit, TitleDisplay, and TitleString properties are used to define, display, and auto-fit the title on a numeric axis. |
|
These methods can be used to control the appearance of labels and titles: |
|
|
|
getDataLabel(): These methods get and set a label string at a specified series and group. |
|
|
get/setAutoSkip(): These methods get and set automatic, manual, or no skipping of labels on an axis. |
|
|
get/setExcludeMaxLabel(): These methods get/set whether or not maximum labels are imaged for an axis in a chart. |
|
|
get/setExcludeMinLabel(): These methods get/set whether or not minimum labels are imaged for an axis in a chart. |
|
|
get/setGroupLabel(): These methods get/set the label string assigned to a group object. |
|
|
get/setLabelStagger(): These methods get/set the label stagger attribute for an axis object. |
|
|
get/setSeriesLabel(): These methods get/set the label string assigned to a series object. |
|
|
get/setSkipBegin(): When setAutoSkip() is used to select manual skipping of labels on an axis, these properties can be used to get or set the first label to be skipped. |
|
|
get/setSkipCount(): When setAutoSkip() is used to select manual skipping of labels on an axis, these properties can be used to get or set the interval of labels to be skipped. |
|
When these methods are used, you may supply an object ID as an input parameter to assign or retrieve the attribute to/from a specific label. If a label object is not specified, the methods assign the attribute to or retrieve the attribute from the first item in the selection list. If the object ID does not identify a label object or the first item in the selection list is not a label object, a "set" operation applies the attribute to the object but it will not have any effect on the appearance of the chart. |
Using Nested/Multi-Dimensional Labels
Perspective supports nested/multi-dimensional labels on the O1 axis with these properties and methods: |
||
|
setO1LabelCallback(): This method assigns a callback function to the nested labels interface. |
|
|
getO1LabelCallback(): This method determines if a callback function has been assigned with setO1LabelCallback(). |
|
|
NestedLabels (true/false): This property enables/disables nested labels. |
|
Use the following procedures to implement the nested labels interface: |
||
1. |
You must create your own version of the nested labels callback. It must implement all of the abstract methods defined in TDGNestedLabel.Java. They are: |
|
abstract int getNumLevels(); |
||
abstract int getNumLabelsOnLevel(int nLevel); |
||
abstract Vector getAllLabels(int nLevel); |
||
abstract String getLabel(int nGroup, int nLevel); |
||
abstract int getLabelGrouping(int nGroup, int nLevel); |
||
2. |
Register the callback with the setO1LabelCallback() method. |
|
Example: |
m_chart.setO1LabelCallback (TDGNestedLabel cb); |
|
3. |
Enable the NestedLabel property. |
|
Example: |
m_chart.setNestedLabels (true); |
|
Perspective includes a simple example of nested labels in the TDGTestNestedGroupsLabels class. The example class can be enabled by setting the NestedLabels properrty to true. |
|
In addition to labels and titles, you may also enable/disable the display of data values (data text) in a chart. |
|
|
|
|
|
Use these properties and methods to display data text and define where and how the data text is displayed: |
|
|
|
DataItemsAlongSeries (True/False): This property determines whether data items are aligned parallel to the series (both rows or both columns). |
|
|
DataTextAngleDefault (0...360): This property sets an angle from center-point that all data text is drawn from. The default value is 90. |
|
|
DataTextDisplay (True/False): This property enables/disables the display of data values next to risers or markers in a chart. |
|
|
DataTextPosition (0...5): This property can be used to define the position where data text is displayed. The default value is 0. |
|
|
DataTextRadiusDefault (0...100): This property sets the default radius that data text will be drawn out from the center of a riser. |
|
|
get/setDataTextAngle(): These methods get/set the angle from center point that all or selected data text is drawn. |
|
|
get/setDataTextRadius(): These methods get/set the radius for the data text position of a specified data point. |
|
The DataTextPosition property determines where data text labels are displayed in the chart. If this property is set to zero, Perspective will use the values set by DataTextAngleDefault or setDataTextAngle and DataTextRadiusDefault or SetDataTextRadius to determine where data text is displayed. The following illustrations show the data text positions that can be selected with DataTextPosition (1...5): |
|
|
setDataTextPosition (1); |
|
|
|
|
|
setDataTextPosition (2); |
|
|
|
|
|
setDataTextPosition (3); |
|
|
|
|
|
setDataTextPosition (4); |
|
|
|
|
|
setDataTextPosition (5); |
|
|
|
Perspective supports three methods for defining the format of data text and numeric axis labels that are displayed in a chart: |
||
1) |
you may select from one of fifteen preset patterns using a ...Text/LabelFormat property |
|
2) |
you may define a standard Java format pattern using one of the ...Text/LabelFormatPattern properties. |
|
3) |
The NumberFormatCallback Interface |
The following ...Format properties are used to select one of the fifteen preset patterns or to tell the charting engine that a format pattern will be used: |
||
|
DataTextFormat (-1...17) | |
|
PieFeelerTextFormat (-1...17) | |
|
PieRingTotalFormat (-1...17) | |
|
X1LabelFormat (-1...17) | |
|
Y1LabelFormat (-1...17) | |
|
Y2LabelFormat (-1...17) | |
When these properties are used, the -1 value tells the charting engine that the format will be defined by one of the ...FormatPattern properties. A value in the range 0...17 selects one of the following formats: |
||
Value |
Format (Example) |
|
-1 |
Use the pattern defined by DataTextFormatPattern |
|
1= |
# (Example: 123 = 123) |
|
2= |
#% (Example: 123 = 12,300%) |
|
3= |
#.#% (Example: 123 = 12,300.0%) |
|
4= |
#.##% (Example: 123 = 12,300.00%) |
|
5= |
$#.## (Example: 123 = $123.00) |
|
6= |
$# (Example: 123 = $123) |
|
7= |
#K (Example: 1,234 = 1K) |
|
8= |
$#K (Example: 1,234 = $1K) |
|
9= |
#M (Example: 1,234,567 = 1M) |
|
10= |
$#M (Example: 1,234,567 = $1M) |
|
11= |
#B (Example: 1,234,567,891 = 1B) |
|
12= |
$#B (Example: 1,234,567,891 = $1B) |
|
13= |
#T (Example: 1,234,567,891,234 = 1T) |
|
14= |
$#T (Example: 1,234,567,891,234 = $1T) |
|
15= |
show number with thousand separators no decimals (Example: 1,234=1K) |
|
16= |
show number with thousand separators two decimals (Example: 1,234=1.23K) |
|
17= |
General currency format for current Locale |
|
Example: |
The following example code selects the dollar format for data text labels: |
|
setDataTextFormat (6); |
||
|
The following ...FormatPattern properties are used to specify a standard Java format pattern: |
||
|
DataTextFormatPattern ( PatternString ) | |
|
PieFeelerTextFormatPattern ( PatternString ) | |
|
PieRingTotalFormatPattern ( PatternString ) | |
|
X1LabelFormatPattern ( PatternString ) | |
|
Y1LabelFormatPattern ( PatternString ) | |
|
Y2LabelFormatPattern ( PatternString ) | |
When these properties are used, the PatternString defines the format of data text or labels in the following format: |
||
pattern:= subpattern{;subpattern} |
||
Notation: |
||
X* |
0 or more instances of X |
|
(X|Y) |
either X or Y. |
|
X..Y |
any character from X up to Y, inclusive. |
|
S - T |
characters in S, except those in T |
|
The first subpattern is for positive numbers. The second (optional) subpattern is for negative numbers. In both cases, a comma (,) can occur inside the integer portion. Here are the special characters used in the parts of the subpattern, with notes on their usage. |
||
0 = |
a digit |
|
# = |
a digit, zero shows as absent |
|
. = |
a period (.) is a placeholder for decimal separator |
|
, = |
a comma (,) is a placeholder for grouping separator |
|
; = |
a semicolon (;) separates formats |
|
-= |
a minus sign/dash (-) is the default negative prefix |
|
%= |
divide by 100 and show as percentage |
|
x= |
any other characters can be used in the prefix or suffix |
|
'= |
a single quote (') is used to quote special characters in a prefix or suffix |
|
If there is no explicit negative subpattern, a minus sign (-) is prefixed to the positive form. That is, "0.00" alone is equivalent to "0.00;-0.00". Illegal formats, such as "#.#.#" or mixing '_' and '*' in the same format, will cause an ParseException to be thrown. From that ParseException, you can find the place in the string where the error occurred. The grouping separator is commonly used for thousands, but in some countries for ten-thousands. The interval is a constant number of digits between the grouping characters, such as 100,000,000 or 1,0000,0000. If you supply a pattern with multiple grouping characters, the interval between the last one and the end of the integer is the one that is used. So "#,##,###,####" == "######,####" == "##,####,####". |
||
This class only handles localized digits where the 10 digits are contiguous in Unicode, from 0 to 9. |
Special Formatting Using Macros
The following properties can be used in bubble, stock, and scatter charts to apply special formatting to data text values: |
||
|
DataTextTemplateBubble(): This property can be used to customize the data text labels and insert MACROS for the actual data any place in a defined string when data text labels are enabled in a bubble chart. | |
|
DataTextTemplateHiLo(): This property can be used to customize the data text labels and insert MACROS for the actual data any place in a defined string when data text labels are enabled in a stock chart. | |
|
DataTextTemplateScatter(): This property can be used to customize the data text labels and insert MACROS for the actual data any place in a defined string when data text labels are enabled in a scatter chart. |
The NumberFormatCallback Interface
The NumberFormatCallback interface represents an abstract Interface to an object that formats the numbers in a chart. You can use these methods in the Perspective to enable and determine if the NumberFormatCallback interface is used: |
||
|
getNumberFormatCallBack(); Determine if a NumberFormatCallBack has been assigned with setNumberFormatCallBack(). | |
|
isNumberFormatCallBack(); Determine if the object is a number format callback. | |
|
setNumberFormatCallBack (NumberFormatCallBack numberFormattingObject); Set a number format callback | |
The provided numberFormattingObject should implement the functions defined in the NumberFormatCallback class to format numeric values in the chart. See the NumberFormatCallback methods in Chapter 10. |
Use the following properties and methods to format and display text objects in the chart: |
||
|
FontSizeAbsolute: This method can be used to enable/disable the use of absolute font sizing (i.e., the font size is not changed regardless of the virtual coordinates system). If this property is enabled (true), use setFontSize() to specify an absolute font size that will not be changed regardless of the size of the window where it is drawn. If this property is disabled (false), use setFontSizeVC to specify a font size that will be scaled when the window size changes. | |
|
get/setFontName(): These methods get and set the font name of a text object. | |
|
setFontSize(): Set an absolute font size in points. | |
|
get/setFontSizeVC(): These methods get and set the font size in virtual coordinates of a text object. Also see Virtual Coordinates for additional information about the virtual coordinates system. | |
|
get/setFontStyle() : These methods get and set the font style (e.g., bold, italic, etc.) of a text object. | |
|
get/setTextJustHoriz(): These methods get and set the horizontal justification attribute of a text object in a chart. | |
|
get/setTextJustVert(): These methods can be used to determine the vertical justification attribute of a text object in a chart. | |
|
get/setTextRotation(): These methods can be used to get and set the rotation attribute of a text object in a chart. | |
|
get/setTextString(): These methods can be used to get and set the string of characters assigned to a text object in a chart. | |
|
get/setTextWrap(): These methods can be used to get and set the wrapping attribute of a text object in a chart. |
These properties and methods can be used to control automatic fitting of text objects in a chart: |
||
|
AxisTextAutofitMax ( value ); This property defines the maximum size of axis text in virtual coordinates. | |
|
AxisTextAutofitMin ( value ); This property defines the minimum size of axis text in virtual coordinates. | |
|
AxisTextAutofitMode ( 0...2 ); This property defines the mode to be used for autofitting axis text. | |
|
AxisTextAutofitPercent ( 0...100% ); When AxisTextAutofitMode is set to two, this property defines the percent to be used for autofitting axis text. All Axis text is maintained within AxisTextAutofitPercent of the axis with the smallest font size as determined by Autofit. | |
|
FootnoteAutofit (True/False): This property enables (true)/disables (false) automatic fitting of the chart footnote text string. The default value is True. | |
|
get/setAutofit(): These methods get and set the auto-fitting attribute of an object in a chart. | |
|
O1/O2/X1/Y1/Y2LabelAutofit (True/False): These properties are used to automatically fit/size all text labels on an axis. | |
|
O1/O2/X1/Y1/Y2TitleAutofit (True/False): These properties are used to automatically fit/size the title on an axis. | |
|
SubtitleAutofit (True/False): This property enables (true) / disables (false) auto-fitting of the chart subtitle string. | |
|
TextAutofitMax/TextAutofitMin(Integer): These properties can be used to specify the maximum and minimum font size (in virtual coordinates) that can be used by the charting engine to automatically fit and size label and title objects within their bounding box. | |
|
TitleAutofit (True/False): This property enables (true) / disables (false) auto-fitting of the chart title string. | |
|
LegendTextAutofit (True/False): This property enables (true) / disables (false) auto-fitting of the legend text. The default value is True. |
When a 3D graph type is selected with the GraphType property, these properties can be used to control the appearance of the 3D cube: |
|||
|
CubeFocusFactor (0...100): This property sets the focus factor for setting perspective distortion in a 3D chart. | ||
|
CubeIsometricProjection (True/False): This property enables (true) / disables (false) isometric projection. | ||
|
CubeLightSourceX/Y/Z (0...100): These properties set the cube light source for the X-, Y, and Z-coordinate (unit space). | ||
|
CubeRiserInterpolation(); This property controls whether risers in 3D charts are interpolated (faster) or explicitly calculated (more accurate). | ||
|
CubeSizeX/Y/Z (0...100): These properties can be used to set the size of the 3D cube in the (user) X-, Y-, and Z-directions. | ||
|
CubeTranslationX/Y/Z (0...100): These properties set the translation of a 3D Cube (in 3D cube coordinates) in the X-, Y-, and Z-direction. | ||
|
CubeViewerX/Y/Z (0...100): These properties set the viewer location (in 3D coordinates) in the X-, Y-, and Z-direction. | ||
|
CubeWallThickX/Y/Z (0...100): These properties set the thickness of the 3D-cube wall in the (user) X-, Y-, and Z-direction. | ||
|
CubeZoomFactor (0...100): This property sets the global scaling factor for zooming in/out. | ||
|
Display3DFloor (True/False): This property enables/disables the display of the floor of the cube in a 3D chart. | ||
|
Display3DLeftWall (True/False): This property enables/disables the display of the left wall of the 3D cube. | ||
|
Display3DRightWall (True/False): This property enables/disables the display of the right wall of the 3D cube. | ||
|
Viewing3DAnglePreset (-1...15): This property selects an entry in the table of "preset" viewing angles for 3D graphs. | ||
-1 = |
Custom (as set by CubeViewerX/Y/Z, CubeWallThickX/Y/Z, etc.) |
||
0= |
Standard (the default) |
||
1= |
Tall and Skinny |
||
2= |
From the Top |
||
3= |
Distorted |
||
4= |
Short and Fat |
||
5= |
Groups Eye |
||
6= |
Group Emphasis |
||
7= |
Few Series |
||
8= |
Few Groups |
||
9= |
Distorted Standard |
||
10= |
Shorter and Fatter |
||
11= |
Thick Wall for Series |
||
12= |
Thick Wall Standard |
||
13= |
California Special |
||
14= |
Blast-O-Vision |
||
Appendix A includes an illustration of each of these preset viewing angles. Also see " 3D Grid Lines" and "Riser and Marker Properties" for information about properties that can be used to control the appearance of grid lines and risers in the 3D cube. |
PIE CHART PROPERTIES AND METHODS
When a pie chart is selected with the GraphType property, these properties and methods can be used to control attributes that are specific to a pie chart: |
||
|
OtherPercentage(0...100%); This property sets the percentage at which a slice in a pie chart will be grouped into the "other" slice when the OtherSeries property is enabled. | |
|
OtherSeries(true/false); This property enables/disables the bundling of small slices (less than OtherPercentage) into a single slice that is labeled "other". | |
|
PieDepth (0...100): This property specifies the depth of the pie crust in a pie chart. The default value is 30. | |
|
PieFeelerTextDisplay (0...3): This property enables (true) / disables (false) the display of feelers and data text in a pie chart. | |
|
PieFeelerTextFormat (0...14): This property determines the format of values that is drawn next to feelers in a pie chart. | |
|
PieLabelDisplay (0...3): This property determines the format of labels displayed next to feelers in a pie chart. The default value is 1. | |
|
PieRingSize (0...100): This property determines the size of the ring (inner circle) in a ring pie. The default value is 30. | |
|
PieRingTotalDisplay (True/False): This property enables (true) / disables (false) the display of a total value in the center of a pie ring chart. | |
|
PieRingTotalFormat: When the PieRingTotalDisplay property is set to true and the total data value is displayed in the center of a ring pie chart, this property sets the format of the data value. | |
|
PieRotate (0...359): This property rotates a pie chart a specified number of degrees. The default value is 0. | |
|
PiesPerRow (integer): This property specifies the number of pies to be drawn in a row in multi-pie charts. The default value is 2. | |
|
PieTilt (0...100): This property tilts a pie chart a specified number of degrees. The default value is 15. | |
|
PieBarSeries (0...# of Series in Chart): This property selects the series that will be used to map the bar in a pie-bar chart. The default value is zero. | |
|
get/setPieSliceDelete(): These methods get and set a boolean value indicating whether or not slices have been deleted from a pie chart. | |
|
get/setPieSliceDetach(): These methods get and set the distance that slices are detached from a pie chart. | |
|
restoreAllSlices(): This method restores all detached/deleted slices from a pie chart. | |
|
isChartPieType(): This method returns a boolean indicating whether or not the GraphType property is set to one of the pie charts. |
When a stock chart is selected with the GraphType property, these properties and methods can be used to control attributes that are specific to a stock chart: |
||
|
DataTextTemplateHiLo : This property is used to assign a special format macro to data text labels when they are enabled for display in a stock chart. | |
|
InterpretAsHLOC: This property is included in Perspective to support backward compatibility with Open-Hi-Lo-Close datasets created for Three |D| Graphics Presentation Graphics Software Development Kit (PGSDK). When this property is true, the data will be interpreted as "High, Low, Open, Close" instead of "Open, High, Low, Close". | |
|
Stock52WeekHighValue() : This property gets and sets the 52-week high value assigned to a stock chart. | |
|
Stock52WeekLowValue() This property gets and sets the 52-week low value assigned to a stock chart. | |
|
Stock52WeekHighDisplay (True/False): This property enables (true) / disables (false) the display of a 52-week high line in a stock chart. | |
|
Stock52WeekLowDisplay (True/False): This property enables (true) / disables (false) the display of a 52-week low line in a stock chart. | |
|
StockCloseSplitDisplay (True/False): This property enables (true) / disables (false) the display of split risers at the stock close value. | |
|
StockCloseTicksDisplay (True/False): This property enables (true) / disables (false) the tick marks at the stock close value. | |
|
StockMovingAverageDisplay (True/False): This property enables (true) / disables (false) the display of a moving average line in a stock chart. | |
|
StockOpenTicksDisplay (True/False): This property enables (true) / disables (false) the tick marks at the stock open values. | |
|
StockTickLength (Integer): This property determines the length of tick marks in a stock chart. | |
|
ViewableGroupsStock: This property specifies the maximum number of groups to be imaged in a stock chart. | |
|
ViewableSeriesStock: This property specifies the maximum number of series to be imaged in a stock chart. | |
|
isChartStockType(): This method returns a boolean indicating whether or not the GraphType property is set to one of the stock charts. |
BUBBLE CHART PROPERTIES AND METHODS
The following properties and methods format special items that are only available in bubble charts: |
||
|
DataTextTemplateBubble: This property is used to assign a special format macro to data text labels when they are enabled for display in a bubble chart. | |
|
QuadrantLineCountX: This property selects a number of quadrant lines on the X-axis in a bubble chart. | |
|
QuadrantLineCountY: This property selects a number of quadrant lines on the Y-axis in a bubble chart. | |
|
getQuadrantLine(): This method gets the object ID of the quadrant lines in a bubble chart. | |
|
getQuadrantLineValueX(): This method gets the vertical location of an X quadrant line. | |
|
getQuadrantLineValueY(): This method gets the horizontal location of a Y quadrant line. | |
|
setQuadrantLineValueX(): This method sets the vertical location of an X quadrant line. | |
|
setQuadrantLineValueY(): This method sets the horizontal location of a Y quadrant line. |
These properties and methods control the color and shading of objects in a chart: |
||
|
Autoshading (true/false): This property enables (true) /disables(false) automatic shading of 3D cube walls and riser faces. When depth effect is applied to a 2D chart with DepthRadius, this property also applies shading to the faces of the 2.5D risers. | |
|
ColorMode (0...2): This property sets the color mode to be used in the chart (automatic, color-by-series, or color-by-group). For 3D Surface charts, automatic mode will cause the chart to be colored by height. For Bar, Line, and Area charts, automatic mode will color the chart by series if there is more than one series or by groups if there is only one series The default value is (0, Automatic). | |
|
ExactColorByHeight (true/false): This property enables (true) / disables (false) exact coloring by height in spectral maps and 3D surface charts. When this property is enabled (true), the actual data value is used to get a color from the "color-by-height gradient". When this property is disabled (false), the colors on the spectral legend are the only ones used and the data value is compared to determine which of those "buckets" it falls into. | |
|
SeriesLooping (1...# of series in graph): This property is used to select the interval at which series color values are repeated. The default setting (32) defines different colors from the first 32 series (0...31). Starting with series 32, the colors are repeated (i.e., series 32...64 have the same colors and 0...31, respectively).. | |
|
get/setBorderColor(): These methods get and set the border color of an object. | |
|
get/setFillColor(): These methods get and set the fill color of an object in a chart. | |
|
get/setFillType(): This method gets and sets the fill type of an object in a chart. The fill type can be a color, gradient, or texture. | |
|
getSelectionBorderColor(): This method returns the border color of the currently selected object. | |
|
getSelectionFillColor(): This method returns the fill color of the currently selected object. | |
|
get/setTransparentBorderColor(): These methods get and set the transparent border color of an object. | |
|
get/setTransparentFillColor() : These methods get and set the transparent fill color of an object. | |
|
setSeriesBorderColor(): This method can be used to set the border color of risers for a specified series in a chart. | |
|
setSeriesFillColor(): This method can be used to set the fill color of risers for a specified series in a chart. | |
|
getColorByHeight():When a chart is colored by height (rather than by series or by group), the charting engine chooses the color of quantative data representations based on the data values supplied to the chart. This happens in spectral map charts and in 3D surface charts. If, for example, the data ranges from 7 to 74 and the Y1 axis scale, therefore, goes from 0 to 80, the charting engine might have the color blue assigned to zero, red assigned to 80, and various interpolated shades for values between zero and 80. Note that Spectral Map charts do include a Y1 axis even though it is not visible in the chart. The getColorByHeight() method returns the IdentObj of the "color by height gradient" (in this case a blue to red one). With the object ID, your application can modify the gradient. Its end colors can be changed or the gradient could be made more complex. | |
When color-by-height is enabled with ColorMode(0) for Spectral Maps and 3D Surface charts and the user selects a data point (spectral marker or surface riser), the charting engine does not highlight the entire series. Instead, all data points that have the same color are highlighted. When the user selects a spectral legend marker, that marker will be highlighted plus the data points of the same value, if any. If the CNTL key is down, ONLY the current selection is highlighted. |
||
When a spectral legend marker is selected, the user can change its color. This modifies the "color-by-height gradient" as follows: 1) if there is already a pin at that point on the gradient, the charting engine changes the color or 2) if not, the charting engine creates a new pin at that point and gives it the specified color. |
||
When a data point is selected, the user can change its color as described above, except that if ExactColorByHeight is false, the charting engine changes the color of the appropriate spectral legend marker's value instead of the color for the exact data value. |
||
Example: |
setExactColorByHeight (false); |
|
Using data ranges from 23 to 57, the gradient goes from Blue (20) to Red (60). There are spectral markers at 20, 25, 30, ...60. When the user clicks on marker "20" and changes it to Black, the colors are interpolated from Black (20) to Red (60). When the user clicks on data point "31" and changes its color to Green, a new pin with color Green is added at 0.25 ("31" is colored as if it were "30" and 30 is 25% of the way from 20 to 60). Now the colors are interpolated as follows: Black (20) to Green (30); Green (30) to Red (60). |
||
Example: |
setExactColorByHeight (true); |
|
When the user clicks on data point "48" and changes its color to Yellow, a new pin is added at 0.7 (48 is 70% between 20 and 60) with the color Yellow. Now the colors are interpolated as follows: Black (20) to Green (30); Green (30) to Yellow (48); Yellow (48) to Red (60). |
||
The following properties and methods can be used to control the display of shadows in a chart. |
||
|
get/setShadowColor() : These methods get and set the color of a shadow applied to an object. | |
|
get/setShadowDisplay() : These methods get and set whether or not a drop shadow is displayed for a particular object in a chart. | |
|
get/setShadowXOffset() : These methods get and set the offset in the X-direction of a drop shadow for a particular object in a chart. | |
|
get/setShadowYOffset(): These methods get and set the offset in the Y-direction of a drop shadow for a particular object in a chart. | |
|
ShadowXOffsetDefault (0...100): This property sets the default value for the X-Offset of a drop shadow. The default value is 30. | |
|
ShadowYOffsetDefault (0...100): This property sets the default value for the Y-Offset of a drop shadow. The default value is 30. |
These properties and methods can be used to apply textures and gradients to chart objects. To use a gradient or texture, the setFillType() method must select a gradient (i.e., setFillType(2);) or texture (i.e., setFillType(3);). |
||
|
get/setGradientDirection(): These methods get and set the gradient pin direction. | |
|
get/setGradientNumPins(): These methods get and set the number of pins in a gradient. | |
|
get/setGradientPinLeftColor(): These methods get and set the left color of the gradient pin. | |
|
get/setGradientPinPosition(): These methods get and set the gradient pin position. | |
|
get/setGradientPinRightColor(): These methods get and set the right color of the gradient pin. | |
|
getTexture(): This method can be used to determine if a texture has been applied to a specific object in a chart or any object in a chart. When a texture name (i.e., a .GIF file name) is supplied is an input parameter, the method identifies whether or not the named texture is applied to any object in the chart. If an Object ID is specified (e.g., getTexture (getSeries(1) );), the method will identify whether or not a texture is applied to the specific object. | |
|
get/setTextureDisplayMode(): These methods get and set the texture display mode assigned to a specific object or all objects in a chart. | |
|
setTextureURL(): This method loads a texture from a file and applies it to object(s) in a chart. The fill type of the object(s) must be set to texture using the setFillType() method (e.g., setFillType (getSeries(1), 3);). | |
The following example code shows how the setFillType() and texture methods can be used to assign a texture to series one in a chart. |
||
perspective1.setFillType(perspective1.getSeries(1), 3 ); |
PANNING, ROTATING, AND SCALING
The following properties and methods can be used to pan, rotate, and scale the cube in a 3D chart: |
||
|
CubeZoomFactor (0...100): This property sets the global scaling factor for zooming in/out. | |
|
CubePanX (0...100): This property pans the 3D chart cube (in 2D virtual coordinates) in the X direction within the chart frame. The default value is 0. | |
|
CubePanY (0...100): This property pans the 3D chart cube (in 2D virtual coordinates) in the Y direction within the chart frame. The default value is 0. | |
|
get/setCubeRotationMatrix() : These methods get and set the rotation matrix of the cube in a 3D chart. |
These properties are used to enable/disable and select the level at which chart objects can be edited in the user interface: |
||
|
ReshapeEnable (True/False): This property enables (true) / disables (false) the user's ability to move and resize objects. The default value is True. | |
|
ResizeBarMode (True/False): This property enables (true) / disables (false) the user's ability to resize bars in a chart. The default value is False. When this property is enabled, the user can use the control key and mouse to resize the bars in a chart. This action will also adjusts the value associated with the riser. | |
|
SelectionEnable (0...5): This property defines the user's ability to select objects in a chart and the operations that can be performed when one or more objects are selected. When SelectionEnable(1) is used, the user can select individual objects (risers, markers, labels, etc.) in a chart. The charting engine highlights each object that is selected. When SelectionEnable(2) is used, the user can only select data-related objects (bars, legends, etc.). The charting engine will highlight the selected data objects and all related objects. When SelectionEnable(3) is used, the user cannot select individual objects. When one object is selected, all related objects will also be selected and highlighted. When SelectionEnable(4) is used, the user can click on a single point and have the chart zoom at the rate of 50% on both axes with the selected point used as the center of the zoom rectangle. When SelectionEnable(5) is used, it allows the user to drag out a rectangle and drill-down on the data within the rectangle area. When this mode is used, a single mouse click will back up one data-zoom level or drill-down. Double click will restore the original un-zoomed data state. See "Data Zooming" in Chapter 6 for more information about using SelectionEnable(4) and SelectionEnable(5). | |
|
SelectionEnableMove (True/False): This property enables (true) / disables (false) the user's ability to select and move individual objects (risers, markers, labels, etc.) in a chart. The default value is True. | |
Also see " Colors and Shading" for more information about how objects are highlighted when they are selected in the user interface. |
Perspective provides informational messages strings that can be enabled for display in the user interface when the user positions the mouse pointer over a selectable object in a chart. The following properties and methods control the format, contents, mode, and frequency of these messages in the user interface. |
||
|
ToolTipDelay (integer): This property gets/sets the delay (in milliseconds) at which tool tips (CharTips and WidgeTips) will be displayed. The default value is 500. | |
|
ToolTipDisplay (True/False): This property enables/disables the display of tool tips. The default value is False | |
|
ToolTipMode (True/False): This property toggles CharTips between explicit developer information and user level information. | |
|
setDeveloperToolTip (String CustomToolTip): When ToolTipDisplay is enabled (true) and ToolTipMode selects developer mode (true), this method can be used to define a custom tool tip string that will be displayed when the user positions the mouse cursor over an object in a chart. Also see the example program (ToolTipDemoOne) in Appendix G. | |
|
setDeveloperToolTipDefault(): This method selects the default developer tool tips provided with the application. | |
|
setDynamicToolTip (String, a ToolTip); This method can be used to set the dynamic tool tip to any specific string. If NULL or "" is used, a tool tip will not be generated. Multiple lines may be used in the string definition. See the macros defined below. | |
|
setToolTipOff(); This method turns off the generation of events for tool tips. | |
|
setUserToolTip (String CustomToolTip): When ToolTipDisplay is enabled (true) and ToolTipMode selects user mode (false), this method can be used to define a custom tool tip string that will be displayed when the user positions the mouse cursor over an object in a chart. | |
|
setUserToolTipDefault(): This method selects the default user-mode tool tips provided with the system. | |
The custom strings defined by setDeveloperToolTip() and setUserToolTip() can include the following macros that are expanded to chart object information: |
||
[GL] |
= Group Label |
|
[OD] |
= Object Description |
|
[OID] |
= Object ID |
|
[OIN] |
= Object Instance |
|
[ON] |
= Object Name |
|
[R] |
= New Line |
|
[SL] |
= Series Label |
|
Example: |
[ON] is ([OID]) [R] Instance # [OIN] |
|
Also see the ToolTipDemo sample program in Appendix G for an example of how the tool tip properties and methods are used. |
||
NOTE: |
You can also use the ToolTipCallback Interface to generate tooltips in your user interface. See ToolTipCallback Methods in Chapter 10 for details. |
When the UseSampleData property is disabled (setUseSampleData(false);), you can use one of the following methods to import and use your own custom data in a chart: |
||
|
Load Data from a server-based text file |
|
|
Place data directly within your HTML page |
|
|
Load data using an SQL query to any JDBC/OCBC compliant database |
|
|
Pass a data object from another Java class or applet |
|
|
Register a data object within your own class to "feed" data automatically to Perspective for Java |
|
|
Set individual values for the chart within your Java code |
|
See Chapter 6 for specific information about loading data into a chart and Perspective properties and methods that support the data interface. |
When the user selects objects in a live chart, the items that are selected may be added to a selection list. Perspective methods let you examine and modify this list and apply attributes to items in the list. The following methods can be used to examine and modify items in the selection list: |
||
|
getSelection(): This method can be used to get the selection list. | |
|
getSelectionBorderColor(): If the first item in the selection list has a border, this method can be used to determine the item's border color (if any). | |
|
getSelectionFillColor(): If the first item in the selection list is an area object, this method can be used to determine the object's fill color (if any). | |
|
getSelectionID(): This method returns the object ID of the currently selected object. | |
|
getSelectionLineWidth(): If the first item in the selection list is a line object, this method can be used to determine the width of the line. | |
|
getSelectionSize(): This method can be used to determine the size of the currently selected object. | |
|
getSelGroup(): This method returns the group number of the currently selected group. | |
|
getSelSeries(): This method returns the series number of the currently selected series. | |
|
isSelection(): This method can be used to determine whether or not there are any items in the selection list. | |
|
isSelectionBorderColorTransparent(): If isSelection() returns true, this method can be used to determine whether or not the first item in the selection list is transparent border color. | |
|
isSelectionCube(): If isSelection() returns true, this method can be used to determine whether or not the first item in the selection list is a 3D cube. | |
|
isSelectionDataLabel(): If isSelection() returns true, this method can be used to determine whether or not the first item in the selection list is a data label. | |
|
isSelectionFillColorTransparent(): If isSelection() returns true, this method can be used to determine whether or not the first item in the selection list is a transparent fill color. | |
|
isSelectionGridLine(): If isSelection() returns true, this method can be used to determine whether or not the first item in the selection list is a grid line. | |
|
isSelectionLegend(): If isSelection() returns true, this method can be used to determine whether or not the first item in the selection list is the legend area. | |
|
isSelectionLine(): If isSelection() returns true, this method can be used to determine whether or not the first item in the selection list is a line object. | |
|
isSelectionRiser(): If isSelection() returns true, this method can be used to determine whether or not the first item in the selection list is a riser object. | |
|
isSelectionSeriesRelated(): If isSelection() returns true, this method can be used to determine whether or not the first item in the selection list is series related. | |
|
isSelectionText(): If isSelection() returns true, this method can be used to determine whether or not the first item in the selection list is a text object. | |
|
setSelection(): This method can be used to add an item to the selection list. | |
The following properties can be used to manipulate how objects are selected in a chart and, therefore, how they are added to the selection list: |
||
|
SelectionEnable(): This property can be used to enable/disable the user's ability to select objects in a chart and to enable/disable data zooming in the user interface. This property has five selectable options: 1) user can select individual objects (risers, markers, labels, etc.) in a chart, 2) user can only select data-related objects (bars, legends, etc.), 3) user cannot select individual objects, 4) user can click on a single point and have the chart zoom at the rate of 50% on both axes with the selected point used as the center of the zoom rectangle, 5) allows the user to drag out a rectangle and drill-down on the data within the rectangle area. | |
|
SelectionEnableMove(): This property can be used to enable/disable the user's ability to select and move objects in a chart. |
Use these methods to load and save files: |
||
|
public void load ( InputStream is, boolean bMerge ); |
|
|
public void load ( String szURL, boolean bMerge ); |
|
|
public void save ( OutputStream os ); |
|
Note that the load methods expect the input stream or URL file to be an ASCII text file that contains Perspective method and property directives. The save() method saves the Perspective method and property directives necessary to recreate the chart in an ASCII text file that can be viewed or edited with a normal text editor. |
||
You may also load and save charts from/to FTP servers using the following methods: |
||
|
boolean getChartFromFTP(); |
|
|
boolean sendChartToFTP(); |
|
|
boolean sendGIFToFTP(); |
|
Use these methods to send a chart to a file or output stream as a GIF image: |
||
|
boolean sendGIFToFile(); |
|
|
boolean sendGIFToStream(); |
|
See Chapter 8 for a description of these methods. |
The URL methods allow you to include drill-downs in HTML files. When the user selects/clicks on an object in a chart where a setURL() is defined, the HTML file provided as an input parameter to the method will automatically be loaded and displayed at the location specified by the setURLTarget(). For example, in the example HTML file below, setURL() selects a different .HTML file for each series/group (slice) in a pie chart. The example setURLTarget() defines the location in the page where each HTML file will be displayed: |
|
get/setURL(): These methods get and set a Universal Resource Locator for any object. | |
|
get/setURLTarget(): These methods get/set the Frame Target for URL associated with any specific Object. |
<html><head><title> |
|
Perspective includes a standard JAVA-style event listener interface and event handler method for collecting events that are specific to the chart user interface. The TDGEvent class defines a set of events that the TDGListener interface can respond to from the chart user interface. See the TDGEvent class and the TDGListener interface below under "Classes & Interfaces" for details. |
An object ID identifies a sub-element in a chart that you can color, display, and, in general, individually apply attributes to. Object IDs are particularly useful for HTML development. Many of the methods described in this chapter and Chapter 8 require or optionally provide an object ID as an input parameter. In most cases, the object ID can be provided as an IdentObj data type from the PerspectiveBase class or as an integer defined in the ObjClassID class. |
|
Example: |
void setDisplay(IdentObj id, boolean newValue); |
void setDisplay(int objectID, boolean newValue); |
|
See Appendix D for an indexed list of methods that return an IdentObj. These methods are described in detail in Chapter 9. The following example code shows how to use these methods to identify an object. |
|
/* A basic extension of the java.applet.Applet class*/ |
|
Perspective also provides static integer variables in the ObjClassID class that can be used to access individual objects in a chart. These variables are listed in Appendix E. All variables that identify a chart object begin with the small letter "k" (e.g., kAreaRiser, kChartBackground, kCubeFloor, kFootnote, etc.). The following example code shows how to use the static variables to identify an object. Note that this code produces the same results as the previous code segment where an IdentObj (e.g., getCubeFloor()) was used to identify the object. |
|
/* A basic extension of the java.applet.Applet class */ |
Perspective for Java is provided in the following classes and defined interfaces: |
||
|
|
tdg Class NumberFormatCallback Class |
|
|
tdg Class ObjClassID Class |
|
|
tdg Class Perspective Class |
|
|
tdg Class PerspectiveBase Class |
|
|
tdg.data.in Interface TDGDataCallbackIF Interface |
|
|
tdg.data.in Interface TDGDataGrid Interface |
|
|
tdg.data.in Interface TDGDataGridPieBar Interface |
|
|
tdg.event Class TDGEvent Class |
|
|
tdg.event Interface TDGListener Interface |
|
|
tdg Interface TDGNestedLabel Interface |
|
|
tdg.data.in Interface TDGPreScaleIF Interface |
|
|
tdg Interface ToolTipCallback Interface |
NumberFormatCallback Class
The NumberFormatCallBack class represents an abstract interface to an object that formats the numbers in a Perspective for Java chart. |
|
Constructor |
public class NumberFormatCallback(); |
|
See Chapter 10 for the methods that are defined in this class. |
ObjClassID Class
This class defines static integer variables that identify objects in a chart. These variables are listed in Appendix E, Static Variables. All variables that identify a chart object begin with the small letter "k" (e.g., kAreaRiser, kChartBackground, kCubeFloor, kFootnote, etc.). |
||
Constructor |
public ObjClassID() |
|
|
Also see the example code shown under " Getting an ObjectID" to see how this class is used. |
|
|
The following methods are also defined in this class: |
|
|
|
static int addExceptionalOffset(int nObjectID) |
|
|
static java.lang.String getObjMethodName(int nObjectID) |
|
|
static int getObjectFromLevel(int nLevel) |
|
|
static boolean isExceptional(int nObjectID) |
|
|
static int stripExceptionalOffset(int nObjectID) |
|
The methods defined in this class are reserved for internal use. |
Perspective Class
The Perspective class is the public interface to Perspective for Java. It inherits all of the methods in the PerspectiveBase class. |
|
Constructor |
public Perspective() |
public Perspective(java.applet.Applet a) |
|
Input: |
a : Identifies a Java Applet (optional) |
Example: |
/* A basic extension of the java.applet.Applet class */ |
|
See Chapters 7 and 8 for the properties and methods that are defined in the Perspective and PerspectiveBase classes. |
PerspectiveBase Class
The Perspective class inherits all of the methods in PerspectiveBase as well as those in Perspective. |
|
Constructor |
public PerspectiveBase() |
Since the Perspective class inherits all of the methods in PerspectiveBase, the PerspectiveBase constructor is not normally required or used. |
|
|
See Chapters 7 and 8 for the properties and methods that are defined in the Perspective and PerspectiveBase classes. |
TDGDataCallbackIF Interface
This interface defines a group of methods that can be used to get and set data in a chart when the setDataFromCallBack() method is used to slave chart data to an arbitrary Java Object. See Chapter 10 for a description of the methods in this interface. |
TDGDataGrid Interface
TDGDataGrid is an abstract interface. It defines a series of methods that you must implement into an object. The TDGDataGrid interface represents an abstract data model that is one way of preparing data for graphing. The methods in this interface are described in Chapter 10. |
TDGDataGridPieBar Interface
This interface defines a method for getting the chart title in a Pie-Bar chart. See Chapter 10. |
TDGEvent Class
TDGEvent is the root event class for all Perspective-level events. It is used in conjunction with the TDGListener Interface to collect user-interface related events. |
||
Constructor |
public TDGEvent( |
|
Input: |
source - the Perspective where the event originated |
|
|
id - the event type |
|
|
This method constructs a TDGEvent object with the specified source Perspective and type. |
|
|
The TDGEvent class defines the following static integer variables to identify events. |
|
|
|
TDG_3DPRESET_CHANGED : Notify listeners the 3D Preset Changed |
|
|
TDG_APPLY_COLOR : Notify listeners to apply color change to current selection, if any. |
|
|
TDG_CALC_PERFORMED : Notify listeners that a calculation has been performed. |
|
|
TDG_EDITOR_STATE_TOGGLE : Notify listeners the editing state has been toggled. |
|
|
TDG_FIRST_EVENT_ID: The lowest event ID allowed in Perspective JavaCHART |
|
|
TDG_GRAPHTYPE_CHANGED : Notify listeners the GraphType was changed. |
|
|
TDG_KEY_PRESSED : Notify listeners a key was pressed. |
|
|
TDG_KEY_RELEASED : Notify listeners a key was release. |
|
|
TDG_KEY_TYPED : Notify listeners a key was typed. |
|
|
TDG_LAST_EVENT_ID: The highest event ID allowed in Perspective JavaCHART |
|
|
TDG_MOUSE_CLICKED : Notify listeners of a mouse click event. |
|
|
TDG_MOUSE_DRAGGED : Notify listeners of a mouse drag event. |
|
|
TDG_MOUSE_ENTERED : Notify Listeners that mouse entered. |
|
|
TDG_MOUSE_EXITED : Listeners that mouse exited. |
|
|
TDG_MOUSE_MOVED : Notify listeners of mouse move. |
|
|
TDG_MOUSE_PRESSED : Notify listeners mouse button pressed. |
|
|
TDG_MOUSE_RELEASED : Notify listeners mouse button released. |
|
|
TDG_NOT_ENOUGH_DATA : Notify listeners not enough data to draw the chart |
|
|
TDG_RESIZE_HANDLE_CHANGED: Notify listeners that the mouse is over a resize handle. |
|
|
TDG_SELECTION_CHANGE : Perspective selection changes |
The following methods are also defined in this class: |
||
|
|
java.lang.Object getSource() |
|
|
java.lang.Object getDataObject() |
|
|
int getID() |
TDGListener Interface
|
Perspective includes a standard JAVA-style event listener interface and event handler method for collecting events that are specific to the chart user interface. TDGListener is the listener interface for receiving perspective events. The TDGEvent class defines a set of events that the TDGListener interface can respond to from the chart user interface. The following methods support the listener interface: |
|
|
|
addPerspectiveListener (TDGListener listener); Defined in PerspectiveBase class |
|
|
perspectiveEvent (TDGEvent e); Defined in the TDGListener interface. |
|
The addPerspectiveListener() method defines the listener interface. |
|
Example: |
perspective1.addPerspectiveListener(this); |
|
|
This method creates an instance of an abstract class or interface to catch high-level events defined by the Perspective for Java integration. The "this" pointer refers to the object in which this method is invoked. This method also tells the charting engine to notify the perspectiveEvent() method when a Perspective event occurs. |
|
|
The perspectiveEvent() method will be called with an event object when an Perspective event occurs. The perspectiveEvent() must be included and defined in the "this" object identified by addPerspectiveListener(). The definition of the perspectiveEvent() method should indicate handling of events that are reported by the charting engine. |
|
Example: |
public void perspectiveEvent(tdg.event.TDGEvent event) |
|
|
The events are defined in the TDGEvent class. |
|
|
Also see the "FullMetalListener" sample program in Appendix G for an example of how to use addPerspectiveListener() and perspectiveEvents() and how to enable, collect, and process Perspective events. |
TDGNestedLabel Interface
|
This interface defines methods for getting information about nested ordinal axis labels. This interface is described in Chapter 10. |
TDGPreScaleIF Interface
|
This interface is used in conjunction with the TDGDataGrid interface to handle large data sets. This interface is described in Chapter 10. |
ToolTipCallback Interface
This interface defines a dynamic callback function to produce a tooltip. See the ToolTipCallback Methods in Chapter 10. |