|
If new to ProEssentials, before reviewing this content, please review
example 000 in the included demo and example
projects. Next
review Chapter 6 Comparison
Subsets.
MultiAxesSubsets
You will use the MultiAxesSubsets
property to subdivide your subsets among multiple axes. When not using
OverlapMultiAxes, only
two y axes (one left, and one right) can share the same graph real-estate.
When MultiAxesSubsets are defined, resulting (right/left) axes-pairs are
stacked vertically top to bottom.
We will discuss OverlapMultiAxes later in this section. You first
need to understand MultiAxesSubsets before you can use or understand
OverlapMultiAxes. Let's start with an example.
For example: a graph has 5 subsets and you want to divide these 5 subsets
among 3 y axes. The first (top) y axis will have 1 subset, the second
(middle) y axes will have 2 subsets, and the third and final y axis (bottom)
will have 2 subsets.
Note that when we add up all the MultiAxesSubsets values (1, 2, 2) they
equate to 5 the same value we set for the Subsets property. This should
always be the case.
The above code produces the following graph.
To expand on this example, lets make an adjustment so that the middle
y axis has 1 subset plotted with respect to the left y axis and the second
subset plotted with respect to the right y axis. We also want to label
the left and right y axes and plot the second subset as a Bar and the
third subset as Points plus Spline.
The above code produces the following graph. Note how setting WorkingAxis
= 1 controls those subsets and y axes defined by MultiAxesSubsets(1).
Also note that RYAxisComparisonSubsets
no longer represents the number of subsets at the end of data, but the
number of subsets at the end of data for a particular MultiAxesSubsets.
Note that we use the term middle axis, but in fact, the middle axis
has two axes, one left and one right. To reiterate, each MultiAxesSubsets
is a section of the chart which can contain one left and/or one right
y axis.
MultiAxesSubsets has a limitation of 16 sections. Each section containing
one left and/or one right y axis. Thus, you will only use indices (0)
through (15) with this property array. This also means the WorkingAxis
property only has valid values between 0 and 15.
OverlapMultiAxes
Now lets discuss OverlapMultiAxes.
This property array lets you subdivide your MultiAxesSubsets as MultiAxesSubsets
lets you subdivide your Subsets. In other words, you can subdivide your
MultiAxesSubsets among overlapping multiple axis sections. Like MultiAxesSubsets,
these overlapping sections start at the top and grow downward. Again,
it's easier to visualize in an example.
Lets expand on the above example one more time. This time we want the
middle and bottom y axes to overlap, using the same chart real-estate.
All we do is add the two following lines of code...
|
'** Dividing MultiAxesSubsets into overlapping sections **'
Pego1.PeGrid.OverlapMultiAxes(0) = 1
Pego1.PeGrid.OverlapMultiAxes(1) = 2 |
To further discuss...
|
Pego1.PeGrid.OverlapMultiAxes(0) = 1 |
The above line of code tells ProEssentials that the first overlapping
section will have one multi-axis. Thus, there really is no overlapping
taking place in this first section.
|
Pego1.PeGrid.OverlapMultiAxes(1) = 2 |
The above line of code tells ProEssentials that the second overlapping
section will have two multi-axes. This causes the last two MultiAxesSubsets
defined to overlap each other.
Now, note that when we add up all the OverlapMultiAxes values (1, 2)
they equate to 3 the same number of MultiAxesSubsets elements we defined
...
|
1) Pego1.PeGrid.MultiAxesSubsets(0) = 1
2) Pego1.PeGrid.MultiAxesSubsets(1) = 2
3) Pego1.PEGrid.MultiAxesSubsets(2) = 2 |
This should also always be the case in your code.
Below is a final example setting overlapping axes and attributes of
bottom axis...
|
'** We've added Gigasoft.ProEssentials.Enums Import above **'
'** Make some random data **'
Pego1.PeData.Subsets = 5
Pego1.PeData.Points = 4
For s = 0 To 4
For
p = 0 To 4
If
(s = 2) Then ' Make Third Subset Larger Data
Pego1.PeData.Y(s,
p) = 50 + (Rnd() * 250)
Else
Pego1.PeData.Y(s,
p) = 5 + (Rnd() * 25)
End
If
Next
p
Next s
'** Dividing Subsets Among 3 Y Axes **'
Pego1.PeGrid.MultiAxesSubsets(0)
= 1 'first/top axis 1 subset
Pego1.PeGrid.MultiAxesSubsets(1) = 2 'second/middle axis 2 subsets
Pego1.PeGrid.MultiAxesSubsets(2) = 2 'last/bottom axis 2 subsets
'** Dividing MultiAxesSubsets into overlapping sections **'
Pego1.PeGrid.OverlapMultiAxes(0)
= 1
Pego1.PeGrid.OverlapMultiAxes(1) = 2
'** Set some attributes of middle axis **'
Pego1.PeGrid.WorkingAxis = 1 '1
= zero based index for middle axes}
Pego1.PePlot.Method = GraphPlottingMethod.Bar
Pego1.PePlot.RYAxisComparisonSubsets
= 1
Pego1.PePlot.MethodII = GraphPlottingMethodII.PointsPlusSpline
Pego1.PeString.YAxisLabel = "Mid
Left"
Pego1.PeString.RYAxisLabel = "Mid
Right"
Pego1.PeGrid.WorkingAxis = 0 'Always reset WorkingAxis to zero
'** Set label of bottom left axis **'
Pego1.PeGrid.WorkingAxis = 2 ' = zero based index for third axes
Pego1.PeString.YAxisLabel = "Bottom Left"
Pego1.PeGrid.WorkingAxis = 0 'Always reset WorkingAxis to zero
Pego1.PeGrid.LineControl = GridLineControl.None
Pego1.PeGrid.Option.MultiAxesSeparators
= MultiAxesSeparators.ThickPlusTick
Pego1.PeFunction.ReinitializeResetImage() |
Note how the Bottom Left axis is now along side the Mid Left axis. All
four subsets making up MultiAxesSubsets(1) and MultiAxesSubsets(2) are
plotted in the second overlapping section.
MultiAxesProportions
One final topic related to multi-axes and overlapping-multi-axes is
the property MultiAxesProportions.
This property will allow you to control the size of each of the Multi-Axes
sections, or Overlapping-Multi-Axes sections.
MultiAxesSubsets
When you are only using MultiAxesSubsets (not overlapping), you
define the same number of elements of MultiAxesProportions as used
in MultiAxesSubsets.
In the above example without overlapping axes, you had...
|
'** Dividing Subsets Among 3 Y Axes **'
Pego1.PeGrid.MultiAxesSubsets(0)
= 1 'first/top axis 1 subset
Pego1.PeGrid.MultiAxesSubsets(1) = 2 'second/middle axis 2 subsets
Pego1.PeGrid.MultiAxesSubsets(2) = 2 'last/bottom axis 2 subsets |
Thus you will also have three elements of proportions like...
|
'** Controlling size of each multi-axis **'
Pego1.PeGrid.MultiAxesProportions(0) = .15 'top axis uses 15%
Pego1.PeGrid.MultiAxesProportions(1) = .35 'next axis uses 35%
Pego1.PeGrid.MultiAxesProportions(2) = .50 'last axis uses 50% |
Note how 15 + 35 + 50 = 100. The values of MultiAxesProportions will
always add up to 100 percent.
OverlapMultiAxes
When you are using OverlapMultiAxes, then you define the same
number of elements of MultiAxesProportions as used in the OverlapMultiAxes.
For the above example where you are overlapping axes, you added...
|
'** Dividing MultiAxesSubsets into overlapping sections **'
Pego1.PeGrid.OverlapMultiAxes(0)
= 1
Pego1.PeGrid.OverlapMultiAxes(1) = 2 |
Since you are using Overlapping-Multi-Axes, you will have only two elements
of proportions like...
|
'**Controlling size of each overlapping multi-axis **'
Pego1.PeGrid.MultiAxesProportions(0) = .40 '{top section uses 40%
Pego1.PeGrid.MultiAxesProportions(1) = .60 'next section uses 60% |
TIP:
As some last general implementation hints. First ignore OverlapMultiAxes
and MultiAxesProportions and initially implement only MultiAxesSubsets.
After you have all the individual axes looking as desired, then add the
OverlapMultiAxes property elements to overlap the desired axes. Finally,
if needed add MultiAxesProportions to contain the same number of elements
as OverlapMultiAxes. If you follow this approach it will greatly enhance
your understanding on how OverlapMultiAxes are implemented. Note that
when implementing MultiAxesSubsets, the subsets have to be in the order
that you want them allocated to axes. The same goes for OverlapMultiAxes
and the axes have to be in the order that you want them allocated to overlap.
Look in the example projects for examples 012,
013, 103 and 104 on how multiple and overlapped y axes are implemented.
|