Visit Gigasoft's Web Site
ProEssentials v6 Help

Chapter 6: Creating Custom Scales

 

This topic discusses the use of annotations and events to create a custom scale.

 

Using Line Annotations to create a scale

Disable the default scale and replace it with your own tick marks and/or grid lines defined with line annotations.

 

Also refer to demo project example 005 on creating custom scales.

 

For custom y axes:

HorzLineAnnotation

Y location of line annotation.

HorzLineAnnotationType

Line type, generally GridTick(7) or GridLine(8)

HorzLineAnnotationText

Text associated with this annotation. Can include various justification codes.

HorzLineAnnotationColor

Color of annotation.

HorzLineAnnotationAxis

Axis location (0 - 5) if using Multi-Axes.

HorzLineAnnotHotSpot

Non-Zero to designate annotation as a hot spot.

 

For custom x axes:  

VertLineAnnotation

X location of line annotation.

VertLineAnnotationType

Line type, generally GridTick(7) or GridLine(8)

VertLineAnnotationText

Text associated with this annotation. Can include various justification codes.

VertLineAnnotationColor

Color of annotation.

VertLineAnnotHotSpot

Non-Zero to designate annotation as a hot spot.

 

Custom scales generally use special line annotation types of...

  • PELAT_GRIDTICK 7

  • PELAT_GRIDLINE 8

These annotation types will create tick marks and grid lines as needed. They will function as normal grid lines and can be controlled by the user via the GridLineControl user customization, or by the developer with the GridLineControl property.

 

For more information on adding annotations to a chart, look at Question 10.

 

The following example shows how to create a simple textual y axis.

 

'** Disable default scale **'

Pego1.ShowYAxis = PESA_EMPTY

 

'** Generally, a custom y axis will need manual range control **'

Pego1.ManualScaleControlY = PEMSC_MINMAX

Pego1.ManualMinY = 0

Pego1.ManualMaxY = 1000

 

'** Create custom grid lines with HorzLineAnnotations **'

'** Note that GridLineControl will control these annotations **'

Pego1.HorzLineAnnotation(0) = 200

Pego1.HorzLineAnnotationType(0) = PELAT_GRIDLINE

Pego1.HorzLineAnnotationText(0) = "|LLow Value"

 

Pego1.HorzLineAnnotation(1) = 500

Pego1.HorzLineAnnotationType(1) = PELAT_GRIDLINE

Pego1.HorzLineAnnotationText(1) = "|LMedium Value"

 

Pego1.HorzLineAnnotation(2) = 800

Pego1.HorzLineAnnotationType(2) = PELAT_GRIDLINE

Pego1.HorzLineAnnotationText(2) = "|LHigh Value"

 

Pego1.HorzLineAnnotation(3) = 350

Pego1.HorzLineAnnotationType(3) = PELAT_GRIDTICK

Pego1.HorzLineAnnotationText(3) = ""

 

Pego1.HorzLineAnnotation(4) = 650

Pego1.HorzLineAnnotationType(4) = PELAT_GRIDTICK

Pego1.HorzLineAnnotationText(4) = ""

 

'** Set LeftMargin to allocate space for line annotation text **'

'** Use the longest string used in annotations.

Pego1.LeftMargin = "Medium Value "

 

'** Set this to see annotations **'

Pego1.ShowAnnotations = True

 

'** Increase line annotation text size **'

Pego1.LineAnnotationTextSize = 100

 

'** Put Grid In Front **'

Pego1.GridInFront = True

 

The following image is produced by the above code.

 

 

Note the three labels on left y axis.

 

This example first disables the default y axis with ShowYAxis.

 

Next, it manually chooses a range for the new y axis. This new range will be from 0 to 1000.

 

Next, three grid-line annotations are added at coordinates of 200, 500, and 800 within the 0 to 1000 axis range. Note that the HorzLineAnnotationText items are using justification codes "|L" to place text on the outside left edge. Refer to HorzLineAnnotationText for more info on justifying line annotation text.

 

Next, two grid-tick annotations are added at coordinates 350 and 650. Note that the text for these annotations is a null string.

 

Next, the LeftMargin property is set. This is a textual property which should be set to the largest string used for any annotation text. ProEssentials will use this example text to determine the amount of space to reserve for line annotations placed on the outside left edge of the chart. It's usually a good idea to make this text string slightly larger by a few characters.

 

Finally, ShowAnnotations is set to true, LineAnnotationTextSize will generally be set to 100, and the grid is placed in front with GridInFront.

 

 

 

Using the CustomGridNumber Event

This method of creating a custom scale uses an event to allow the developer opportunity to change the textual representation of a data value.

 

You set one or more of the following properties to true to enable event processing:

 

CustomGridNumbersY

Enable custom Y axis.  

CustomGridNumbersX

Enable custom X axis.

CustomGridNumbersRY

Enable custom Right Y axis.

CustomGridNumbersTX

Enable custom Top X axis.

CustomGridNumbersZ

Enable custom Z axis.

 

Please refer to demo project example 132 on seeing the specifics of handling the CustomGridNumber event within the development language of your choice.