Written by Erez Wenger - January 2012
Graph axis labels are custom labels that can be used on a graph axis. One can change the labels to show special information at certain values, strings such as names or days of the week or anything else instead of the default numeric values.
In order to use these custom labels, you need to go into the graph control edit panel and select the Bottom X-Axis.
Check the 'Enable Label String' check-box on the bottom of the new window:
1. Using the GUI editor
Click the 'Edit Label Strings' (see above figure) and enter a label for each corresponding x axis value:
This means that instead of 0.00, you will see the assigned label (in the above example the label is the silly sentence "This is the label for 0.0 value").
2. Entering labels via the code
Here is an example of label adding via code, the example shows a program that deals with meteorological data, where the bottom x axis should show time instead of numbers. the data that is being plotted consists of 6 values per hour, for an entire day. each time value is represented by a round float number. One can use the function InsertAxisItem which (as its name might suggests) inserts a single axis label to the label list.
Code Example:
for (i=0;i<24;i++)
{
sprintf(str,"%d:00",i);
InsertAxisItem (panelHandle, PANEL_GRAPH, VAL_BOTTOM_XAXIS, -1, str, (float)(i*6));
}
No comments:
Post a Comment