Common Question 25
How do I manually control the axis type, range, and grid line frequencies?
The axis type (linear or log) is controlled with YAxisScaleControl, XAxisScaleControl, RYAxisScaleControl, and TXAxisScaleControl. Note that PEP_nRY... stands for the right y axis, and PEP_nTX... stands for the top x axis.
See example 110 in our demo.
The range is controlled with ManualScaleControlY, ManualMinY and ManualMaxY. Similar properties are available for the x axis, right y axis, and top x axis. You will normally set ManualScaleControlY = PEMSC_MINMAX (3) which tells ProEssentials you are manually setting both the min and max and use the extents defined with ManualMinY and ManualMaxY.
Note that if ManualScaleControlY = PEMSC_NONE (0), then ProEssentials will automatically choose a range by looking at the data and adding a percentage of padding above and below data. The amount of padding is defined with the AutoMinMaxPadding property. Also note that in this case, you can read the ManualMinY and ManualMaxY properties to learn what ProEssentials has chosen to use for the chart's range.
The Graph Object does not use the x and top x axis parameters because it does not use a numerical x axis scale. Instead, it plots some number of data-points along the x axis. This is controlled with the properties Points and PointsToGraph. If using PointsToGraph, you can control which data point plots first by setting the property HorzScrollPos. For more information on the Graph Object's use of the x axis scale, refer to Question 20 in this chapter.
See example 112 in our demo.
Axis Grid Line Frequencies
The scale's grid line frequencies are controlled with ManualYAxisTicknLine, ManualYAxisLine, and ManualYAxisTick. Similar properties are available for the x axis, right y axis, and top x axis. For Graph Object's, refer to Question 20 for information on how to control the x axis grid line frequencies.
You will first set ManualYAxisLine and ManualYAxisTick to desired frequencies and then enable the use of these frequencies by setting ManualYAxisTicknLine to TRUE. For example, setting...
Pego1.ManualYAxisLine = 100
Pego1.ManualYAxisTick = 20
Pego1.ManualYAxisTicknLine = True
will produce a y axis with major grid lines every 100 units (like 1300, 1400, 1500, 1600...) with tick marks every 20 units (like 1320, 1340, 1360, 1380, 1420, 1440...).
Note there is logic to prevent too many grid lines from being used. If ProEssentials thinks too many lines are being requested, it will revert to automatically configuring the grid lines.
Also note there is logic to prevent odd grid line frequencies. You can disable this logic by setting the property NoGridLineMultiples to TRUE. If you are having trouble setting grid lines to certain frequencies, set this property to TRUE.
Note that the use of DateTimeMode is not compatible with ManualXAxisTicknLine. If you need a specific looking date/time scale, you will have to manually produce this scale as described in Question 22.
See example 113 in our demo.
Note that all of the above left and right y axis type properties are related to a particular axis. In the case where you are using MultiAxesSubsets, you will set WorkingAxis prior to adjusting the above properties for that axis. Refer to Question 18 in this chapter for more information on multiple y axes and the use of WorkingAxis.
©2022 Gigasoft, Inc. | All rights reserved.
Gigasoft is a registered trademark, and ProEssentials a trademark of Gigasoft, Inc.