SetDataLabelFormat

Syntax graph.SetDataLabelFormat(label)

Description Specifies the format of the graph's data labels.

Data labels are small boxes of text and data that appear above each data item. If data labels are enabled, the string that you pass to the setDataLabelFormat() method will appear above every data label.

Note: If you have text that you want to put above only one data item, you should use either PopUp text (see graph. AddPopupText) or Notes (see graph. AddNote).

You can use macros to represent information that is data item specific, such as the value of the data item or the series name. For example, consider a data item in a series named Houston whose value is 38. Using the command shown in Example 5.25, the label for this data item would be Houston: 38 Pts..

If this command is not specified, the value from the appearance file will be used.

For more information on data labels, refer to "Data Labels" in Chapter 7 of the PopChart Server User Guide.

Parameters Graph.SetDataLabelFormat() accepts the following parameters.

label

String

Specifies the data label string. The string can contain both regular text and macros.

Macros will be replaced by information specific to each data item when PopChart Server generates the graph. A macro must always be proceeded by a %_, and all of the letters must be upper-case.

Table 5.7 shows the macros that you can use in this string.Some of these macros will not apply for all graph types-—for instance, %_XVALUE only applies to X-Y graphs, while %_PERCENT_OF_TOTAL only applies to bar, line, radar, and pie graphs.
Table 5.7 Data Label Macros
Macro Description Graphs
%_BUBBLE_VALUE The value of the bubble in an X-Y or Time Bubble graph. X-Y or Time Bubble
%_CATEGORY_NAME The name of the category that the data item belongs to. All, except X-Y and Time Plot
%_CATEGORY_TOTAL The sum of all data values in the category to which the data item belongs (applies to Area, Bar, Line, Pareto, Pie, Radar
%_CLOSE_VALUE The close value for a high-low data item. Stock
%_GRAPH_TOTAL The sum of all data values in a bar, line, pie, or radar graph. Area, Bar, Line, Pareto, Pie, Radar
%_HIGH_VALUE The high value for a high-low data item. Stock
%_LOW_VALUE The low value for a high-low data item. Stock
%_OPEN_VALUE The open value for a high-low data item. Stock
%_PERCENT_OF_CATEGORY The data value represented as a percentage of the sum of all data values in its category. Area, Bar, Line, Pareto, Pie, Radar
%_PERCENT_OF_TOTAL The data value represented as a percentage of the sum of all data values in the graph. Area, Bar, Line, Pareto, Pie, Radar
%_SERIES_NAME The name of the data series that the data item belongs to. All
%_TIME_VALUE The time value for a Time Plot data item. Time Plot
%_VALUE The value of the data item. Area, Bar, Line, Pareto, Pie, Radar
%_XVALUE The x value for an X-Y data item. X-Y
%_YVALUE The y value for an X-Y or Time Plot data item. X-Y, Time Plot

Example 5.25 Customizing a Data Label

Graph.SetDataLabelFormat(%_SERIES_NAME: %_VALUE Pts.);