|
The Graph Object is designed
to show a series of y values. Every point from 0 to (Points
- 1) can have a label defined by PointLabels.
If there is more than one subset, all subsets share the same point label.
Here is some simple VB6 example code.
|
Pego1.PointLabels(0) = "Label
1"
Pego1.PointLabels(1) = "Label 2"
Pego1.PointLabels(2) = "Label 3"
Pego1.PointLabels(3) = "Label 4" |
Given a default Graph and the above code, the result is the following
image. Note the labels below the x axis.
Now lets expand on this example by increasing the Points property to
50 and see what happens.
|
Pego1.Points = 50
For p = 0 To 49
Pego1.PointLabels(p)
= "Label" + Str$(p + 1)
Next p
Pego1.ForceVerticalPoints
= PEFVP_VERT '(1) Vertical Labels |
From the looks of the graph, it is now actually displaying point labels
every 5th label, it started with the 5th label, and produced 10 point
labels along the x axis. This x axis structure is the result of several
properties which invokes an automatic, partially automatic, or manually
controlled x axis structure.
AltFrequencies is the
property that controls when the graph should abandon the idea of showing
all point labels. The default value is 25, so anytime the graph's Points,
or PointsToGraph property is larger than 25, it will invoke logic that
only places some frequency of point labels rather than all point labels.
In the case of the above graph, since Points equals 50, not all point
labels will be shown.
AltFrequencies is a property
array which stores point label frequency restrictions. In other words,
if this property is used, then the graph must choose from among these
provided frequencies. If this property is not used, any frequency of point
labels can be shown. If more than one frequency is provided, it chooses
the frequency which will produce the number of x axis labels closest to
the value defined by the TargetPointsToTable
property.
In the case of the above graph, since AltFrequencies is not defined,
any frequency can be chosen. The default value of TargetPointsToTable
equals 10 so the graph will choose a frequency that produces the quantity
of x axis labels closest to 10. 50 points divided by the target of 10
x axis labels produces a frequency of 5. Thus, the graph shows every fifth
label.
FirstPtLabelOffset is
a property that controls the location of the first label. The default
value is 0, in which case the first label's position will match the frequency
used to place labels.
In the case of the above graph, since FirstPtLabelOffset is not
used, the first label shown is the 5th label which matches the frequency
used to place labels.
To help understand the above properties, lets demonstrate some variations.
If PEP_naALTFREQUENCIES is set to 51, this forces all labels to be
shown.
To show how to define the frequency of labels and starting label position.
|
Pego1.Points = 50
For p = 0 To 49
Pego1.PointLabels(p)
= "Label" + Str$(p + 1)
Next p
Pego1.AltFrequencies(0) = 10
'Show labels every 10th point
Pego1.FirstPtLabelOffset =
1 'Start labels with first point label |
If PointsToGraph is set to
a value less than Points, then only that quantity of points will
be included in the image and a horizontal scroll bar will be shown to
allow the user to pan left and right through data. If using PointsToGraph,
you can control which data point plots first by setting the property HorzScrollPos. The available horizontal
scrollbar positions will start with 1 and end with Points - PointsToGraph
+ 1. It is important that when setting HorzScrollPos, that the object
first be initialized with PEreinitialize, or via PEactions = 0. This is
because without initializing the object, the object will not have a scrollbar.
For example, if a Graph Object has 150 data points (Points = 150),
then the following code can be used to set various starting data points.
In this case, and with setting PointsToGraph = 35, possible HorzScrollPos
values will be between 1 and 116.
|
'** Initialization code to start at the first data point **'
Pego1.AltFreqThreshold = 40
Pego1.Points = 150
Pego1.PointsToGraph = 35
Pego1.PEactions = 0 ' note that object is initialized
Pego1.HorzScrollPos = 1
'** Initialization code to start at the last data point **'
Pego1.AltFreqThreshold = 40
Pego1.Points = 150
Pego1.PointsToGraph = 35
Pego1.PEreinitialize() '**
note object has to be initialized
Pego1.PEresetimage(0, 0)
Pego1.HorzScrollPos = 116 'note
116 = 150 - 35 + 1; |
|