You can use any field or function in Crystal Reports as a parameter for a CRChart Macro.
For Numeric Parameters:
- Add the report field or function that you want to use with a CRChart macro to the end of "Show value(s)" list in the Data tab of the Chart Expert dialog.
- Make a note of the zero-based position of this field in the "Show value(s)" list.
- In your CRChart macro, use the letter "P" followed by the number that represents the position in the "Show value(s)" list. The letter "P" is case sensitive (i.e., @Y p5 will not work).
- Do not reference an item in the "Show value(s)" list that is part of the dataset being graphed (i.e., do not use "P0"). This would cause that particular data series to disappear.
- You cannot use the same "P" parameter twice (e.g., @USER_FILL P5 5 P5 5 is not valid). You could, however, drag the same field twice into the "Show value(s)" list so that they become P5 and P6 (e.g., @USER_FILL P5 5 P5 6 is valid).
- Only NUMERIC parameters (Integer, Boolean, Real) can be mapped.
- The letter "P" is case sensitive (i.e., @Y p5 will not work).
- Numeric parameter substitution will not work with two "On change of" items. Use @DATASET_MERGE and String Parameters instead.
In the Data tab of the Chart Expert dialog, the "Sum of Table1.ErrBarLo" and "Sum of Table1.ErrBarHi" fields are added at zero-based positions 3 and 4 in the "Show value(s) list.
The @CY macro requires four numeric parameters identifying the location and color of a line to draw on the Y-Axis:
@CY fYValue nRed nGreen nBlue
In this example, the value of P3 (Sum of Table1.ErrBarLo) and P4 (Sum of Table1.ErrBarHi) are used as input parameters to identify the location of the lines:
@CY P3 255 0 0
@CY P4 0 255 0
The first @CY macro draws a red (255 0 0) line on the Y-Axis at value P3. The second @CY macro draws a green (0 255 0) line on the Y-Axis at value P4:
For String Parameters:
Legend labels that contain string~ prefixes can be extracted and used in CRChart macros that use numeric input parameters. Legend labels must be formatted with each prefix string terminated with a tilde (~) and a space:
String0~ String1~ ... Stringn~ Legend Label
Prefix strings must be numeric characters (0...9). Use the letter "S" and the zero-based position of the prefix string (e.g., S0, S1, S2, etc.) as an input parameter to any macro that requires a numeric (integer or real) value. When an Sn parameter is used as an input parameter to a CRChart macro, the prefix is stripped from the legend label and will not be shown in the legend area.
- Sn parameters cannot be used as input parameters to macros that require a string parameter (e.g., @YSZ 1000 0 0 S0 will draw a line with the label "S0" and not the prefix at position S0).
- The letter "S" is case sensitive (i.e., @Y s1 will not work).
The legend label strings contain the following prefixes:
1~ 2008~ 24~ TOYS
1~ 2008~ 24~ TOOLS
1~ 2008~ 24~ TENTS
The @X_AXIS_MODE2 macro requires three numeric parameters that identify the start month, start year, and number of elements to cast X-Axis labels into day/month/year strings:
@X_AXIS_MODE2 nStartMonth nStartYear nElements
Value string prefixes from the legend labels are used as the input parameters to this macro:
@X_AXIS_MODE2 S0 S1 S2
In this example, S0 (1) is used for the macro's nStartMonth parameter, S1 (2008) is used for the nStartYear parameter, and S2 (24) is used for the nElements parameter.
This macro creates X-Axis label strings beginning at nStartMonth S0 (1) and nStartYear S1 (2008) for nStartElements S2 (24). Note that the label prefix strings (1~ 2008~ 24~) are not included in the legend labels. They have been stripped out for use in the @X_AXIS_MODE2 macro.
CRChart is a product from