Reference Lines

Topics:

Reference:

Reference line support is implemented for various chart types excluding pie and pie bar. There can be a total of 3 reference lines for each axis (Y1, Y2, and X1). Each reference line has color and thickness. There can be text associated with each reference line, which can appear in a reference line legend. Each reference line, in addition to being assigned an axis and location, is also assigned an identifier.

Reference: APIs Related to Reference Lines

  • IdentObj getReferenceLineaxisname(int)

    This command gets the reference line object for a particular axis and specific identifier.

  • setReferenceLineValue()

    This command sets the value at which the reference line displays for the specified axis and identifier.

  • IdentObj getReferenceLineTextaxisname(int)

    This command gets the ID of the label for the specified reference line.

  • IdentObj getReferenceLine(IdentObj, int)

    This command gets the reference line object for a particular axis and specific identifier. This API returns null if the specified reference line does not exist.

  • void setReferenceLine(IdentObj , int, double)

    This command creates a reference line for a particular axis and specified identifier.

  • double getReferenceLineValue(IdentObj , int)

    This command returns the location of a reference line for a particular axis and specific identifier.

  • void removeReferenceLineObject(IdentObj, int)

    This command removes the specified reference line object.

Reference: Properties Supported by Reference Lines

  • Width.
  • Color.
  • Display.
  • Value or location.

Example: Creating a Reference Line With a Label

The following code turns on a reference line for the Y1 axis, sets the value at which the line displays to 20,000, creates a label for the reference line, and turns on the display of the label:

setDisplay(getReferenceLineY1(0),true);
setReferenceLineValueY1(0,20000.0);
setLineWidth(getReferenceLineY1(0),2);
setTextString(getReferenceLineTextY1(0),"Salary at 20K");
setDisplay(getReferenceLineTextY1(0),true);

Example: Creating a Reference Line

The following example creates a Y1 Axis reference line at the y = 50 with the color red and a width of 3.

setReferenceLine(getY1Axis(),0, 50.0);
setLineWidth(getReferenceLine(getY1Axis(),0),3);
setFillColor(getReferenceLine(getY1Axis(),0), new Color(255,0,0)); 

The following line hides a reference line:

setDisplay(getReferenceLine(getY1Axis(),0),false);

The following line shows how to associate text with the reference line:

setTextString(getReferenceLine(getY1Axis(),50),"label");

APIs Related to the Reference Line Legend

  • IdentObj getReferenceLineLegendText(IdentObj ,int)

    Gets the reference line legend text IdentObj.

The following line hides the legend text for a reference line:

setDisplay(getReferenceLineLegendText(getY1Axis(),0),false) 

WebFOCUS

Feedback