Annotation Classes
Annotations are an important part of the chart or graph. Objective Chart has a flexible annotation system that allows you to associate many separate text strings with one item. These annotation lists are primarily used to provide multilingual labels for the chart.
Annotations can now comprise multiple line text. Use the new line character \n to separate lines.
A numeric (country) code is tied to each text string in an SRGraphAnnotation object.
SRGraphAnnotation objects are rarely used alone. They are generally stored in an SRGraphAnnotationList, derived from CObList. At any time, the annotations with a particular code value are displayed. The displayed annotation set can be selected instantly by changing the country code key stored in the main graph object.
For example, you can store strings in various languages for all the countries in which your company does business. Each string can be coded with the country’s telephone dialing code. When the application containing this chart is distributed to the various countries, the chart automatically (given the proper setup) displays its labels in the appropriate language.
A member variable in the SRGraph object determines which set of annotations is displayed. By default, it is set to 01, the country code of the USA, but other codes could be used. For example, one set of annotations could be displayed for company executives and another for the shareholders.
The figure below shows the structure of an SRGraphAnnotation and SRGraphAnnotationList.
Figure 13 – Block diagram of an annotation
All of the data storage objects in Objective Chart have an annotation list associated with them. The annotation list of the data lists are used as group headers, which are often displayed in legends and occasionally as axis labels. The annotation lists of the individual data items are often used as axis labels and included in chart tips. For a few chart types, they may appear in legends. The SRGraph object has an annotation list that is displayed in an SRGraphTitle component as a title for the chart. The text in an SRGraphLabel object is stored as an annotation list.
The power of this annotation system may not be required for most applications. An annotation list with one annotation string does take up slightly more space than, say, a CString. Overall, the overhead is minimal. If labels are not needed for a particular object, they do not need to be provided.