Chart FX for Java 6.2

SoftwareFX.ChartFX
Class ConstantLine

java.lang.Object
  extended bySoftwareFX.ChartFX.ConstantLine

public final class ConstantLine
extends java.lang.Object

Provides access to the ConstantLine object.

Constant lines are one of the most useful objects when it comes to highlighting information in the chart area. You may want to create a constant line to highlight limits or specific points of interest in the chart. For example, in a scientific application, you may want to use the constant line object to highlight an alarm limit, or in a financial application you may want to use the constant line to highlight a target price or date.

Constant lines are lines that you can draw anywhere in the chart area and they associate themselves with a particular value in the axis that they're assigned to, as illustrated in the following figure.

To create a constant line you don't need a whole new data series and you can also configure labels and line styles, colors and width.

If you want to highlight a range of values instead of a specific value, please refer to the Stripe object.


Constructor Summary
ConstantLine()
           
 
Method Summary
 int getAlignment()
          Specifies the alignment for the constant line text relative to the configured X or Y axis.
 int getAxis()
          Used to associate the selected constant line with one of the axes.
 java.awt.Color getColor()
          Allows you to set the line color for a selected line.
 int getEndCap()
          Allows you to configure a marker shape at the ending of a selected line.
 int getFlags()
          Used to control additional settings for the selected constant line.
 java.awt.Font getFont()
          Allows you to modify the text font attributes for the selected constant line.
 int getLineAlignment()
          Specifies the alignment of the constant line text relative to the constant line object.
 Link getLink()
          Gets the Link object for a selected ConstantLine item.
 int getPoint()
          Gets or sets a value indicating the point a ConstantLine is associated.
 int getSeries()
          Gets or sets a value indicating the series a ConstantLine is associated.
 int getStartCap()
          Allows you to configure a marker shape at the beginning of a selected line.
 int getStyle()
          Allows you to set the line style for a selected line.
 java.lang.String getText()
          Used to set a text label for a selected constant line.
 java.awt.Color getTextColor()
          Used to change the text color for the constant line text.
 java.lang.String getURL()
          Deprecated. You should use ConstantLine.getLink().getUrl instead.
 double getValue()
          Used to set a value for the selected constant line.
 int getWidth()
          Gets or sets the line width for a selected line.
 boolean isOutsideText()
          Allows you to position the constant line text outside the chart area.
 boolean isShowLine()
          Allows you to show or hide a constant line in the chart.
 boolean isShowText()
          Used to show or hide the constant line text in a chart.
 void setAlignment(int value)
          Specifies the alignment for the constant line text relative to the configured X or Y axis.
 void setAxis(int value)
          Used to associate the selected constant line with one of the axes.
 void setColor(java.awt.Color value)
          Allows you to set the line color for a selected line.
 void setEndCap(int value)
          Allows you to configure a marker shape at the ending of a selected line.
 void setFlags(int value)
          Used to control additional settings for the selected constant line.
 void setFont(java.awt.Font value)
          Allows you to modify the text font attributes for the selected constant line.
 void setLineAlignment(int value)
          Specifies the alignment of the constant line text relative to the constant line object.
 void setOutsideText(boolean value)
          Allows you to position the constant line text outside the chart area.
 void setPoint(int value)
          Gets or sets a value indicating the point a ConstantLine is associated.
 void setSeries(int value)
          Gets or sets a value indicating the series a ConstantLine is associated.
 void setShowLine(boolean value)
          Allows you to show or hide a constant line in the chart.
 void setShowText(boolean value)
          Used to show or hide the constant line text in a chart.
 void setStartCap(int value)
          Allows you to configure a marker shape at the beginning of a selected line.
 void setStyle(int value)
          Allows you to set the line style for a selected line.
 void setText(java.lang.String value)
          Used to set a text label for a selected constant line.
 void setTextColor(java.awt.Color value)
          Used to change the text color for the constant line text.
 void setURL(java.lang.String value)
          Deprecated. You should use ConstantLine.getLink().setUrl instead.
 void setValue(double value)
          Used to set a value for the selected constant line.
 void setWidth(int value)
          Gets or sets the line width for a selected line.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantLine

public ConstantLine()
Method Detail

getAlignment

public int getAlignment()

Specifies the alignment for the constant line text relative to the configured X or Y axis.

Values:
StringAlignment : The StringAlignment type specifies how a string is aligned in reference to the bounding rectangle. A bounding rectangle is used to define the area in which the text displays.
ValueDescription
STRING_ALIGNMENT_NEARSpecifies that alignment is towards the origin of the bounding rectangle. May be used for alignment of characters along the line or for alignment of lines within the rectangle. For a right to left bounding rectangle, the origin is at the upper right.
STRING_ALIGNMENT_CENTERSpecifies that alignment is centered between origin and extent (width) of the formatting rectangle.
STRING_ALIGNMENT_FARSpecifies that alignment is to the far extent (right side) of the formatting rectangle.

Remarks:
  • You need to specify the constant line text with setText(java.lang.String) property in order to see the alignment.

  • In order to create a constant line, you must first set the constant line value with the setValue(double) property and the axis associated with it using the setAxis(int) property.

  • To change the font for constant lines, please refer to the setFont(java.awt.Font) property.

  • To highlight a range of values in a particular axis, please refer to the StripeStripe.

  • In the following chart, the constant line Alignment has been set to StringAlignment.Center:

  • See Also:
    setAxis(int), setFont(java.awt.Font), setText(java.lang.String), setValue(double), Stripe

    getAxis

    public int getAxis()

    Used to associate the selected constant line with one of the axes.

    Values:
    AxisItem : Allows Axis selection for properties needing axis assignment.
    ValueDescription
    YPrimary Y Axis.
    Y2Secondary Y Axis.
    XPrimary X Axis.
    X2Secondary X Axis.

    Remarks:
  • If no axis is specified, the default axis is the Y axis.

  • When assigned to any of the Y axes (left or right), the constant line will be a horizontal line that will cross the chart from left to right. When assigned to the X axis, the constant line will be a vertical line that will cross the chart from top to bottom.

  • Use the setValue(double) property to set where the constant line will be positioned on the X or Y axis.

  • It is common practice to label the constant line to indicate what it represents in the chart. For example, a constant line may show the text "Alarm Limit" so the user is aware of its importance. The label for a constant line can be set using the setText(java.lang.String) Property.

  • To highlight a range of values in a particular axis, please refer to the Stripe.

  • In this chart, the constant line has been configured to the X axis:

  • See Also:
    setAlignment(int), Line.setColor(java.awt.Color), Line.setStyle(int), setText(java.lang.String), setValue(double), Stripe, Line

    getColor

    public java.awt.Color getColor()

    Allows you to set the line color for a selected line.

    Remarks:
  • When this property is applied to an axis line, both the primary and secondary axes are affected. For instance, when you change the X axis line color using this property both axes lines above and below the chart area are colored.

  • You may also control the Line.setWidth(int) and Line.setStyle(int) of the selected line using the supported members of the Line .

  • The Line.setEndCap(int) and Line.setStartCap(int) properties allow you to configured various shapes at the beginning and ending of a selected line.

  • For more information regarding the Color type, please refer to the Java API Documentation.

  • See Also:
    Line.setEndCap(int), Line.setStartCap(int), Line.setStyle(int), Line.setWidth(int), Chart.getAxisY(), Chart.getAxisX(), Chart.getConstantLines(), Chart, ConstantLine

    getEndCap

    public int getEndCap()

    Allows you to configure a marker shape at the ending of a selected line.

    Values:
    LineCap : Specifies the available cap styles with which a line can end.
    ValueDescription
    ANCHOR_MASKSpecifies a mask used to check whether a line cap is an anchor cap.
    ARROW_ANCHORSpecifies an arrow-shaped anchor cap.
    CUSTOMSpecifies a custom line cap.
    DIAMOND_ANCHORSpecifies a diamond anchor cap.
    FLATSpecifies a flat line cap.
    NO_ANCHORSpecifies no anchor.
    ROUNDSpecifies a round line cap.
    ROUND_ANCHORSpecifies a round anchor cap.
    SQUARESpecifies a square line cap.
    SQUARE_ANCHORSpecifies a square anchor line cap.
    TRIANGLESpecifies a triangular line cap.

    Remarks:
  • When this property is applied to an axis line, both the primary and secondary axes are affected. For instance, when you change the X axis EndCap using this property both axes lines above and below the chart area are modified.

  • An starting marker shape may be applied to lines using the Line.setStartCap(int) property.

  • You can also control Line.setColor(java.awt.Color), Line.setStyle(int) and Line.setWidth(int) for a selected line object using the supported members of the Line .

  • See Also:
    Line.setStartCap(int), Line.setColor(java.awt.Color), Line.setStyle(int), Line.setWidth(int), Chart.getAxisX(), Chart.getAxisY(), Chart

    getFlags

    public int getFlags()

    Used to control additional settings for the selected constant line.

    Values:
    ConstantFlag : ConstantLine enums.
    ValueDescription
    DEFAULTSets all constant line styles back to default.
    HIDE_TEXTDoes not display label associated with the selected constant line.
    HIDEHides the selected constant line and text.
    BACK_ONLYDraws constant line only in the background of the 3D wall when chart is in 3D mode.
    COLOR_TEXTMakes text color same color as constant line.
    HIDE_LINEHides the selected constant line.
    OUTSIDE_TEXTDisplays the text for the constant line outside the chart area.
    SHOW_VALUEDescription goes here

    Remarks:
  • This property is a word property. This means all settings represent a bit in the word that you need to turn on or off according to the desired result. For this purpose you need to use the bitwise operators (And, Or, Not, Xor) provided by your development tool.

    Because it is a word property, you must make sure you use these operators to turn on/off bits and avoid losing previous settings to the property.

    For example, if you want to use the ConstantFlag.HideText setting.

    The right way of setting this property is:

    chart1.getConstantLine(0).setFlags(chart1.getConstantLine(0).getFlags() | ConstantFlag.HIDE_TEXT);

    If you type the following code:

    chart1.getConstantLine(0).setFlags(ConstantFlag.HIDE_TEXT);

    (WRONG!)

    you will erase all other settings in the property causing an erratic behavior of the library.

  • See Also:
    setAxis(int), setFont(java.awt.Font), setText(java.lang.String), setTextColor(java.awt.Color), Axis.setStyle(int), Stripe, Axis, Line

    getFont

    public java.awt.Font getFont()

    Allows you to modify the text font attributes for the selected constant line.

    Remarks:
  • You can set the font for the entire chart using the Chart class Chart.setFont(java.awt.Font) property.

  • When setting a font in Chart FX, you must create a new font object with the desired attributes and assign that object to the desired chart element every time you want to change the font.

  • For more information regarding the Font type, please refer to the Java API Documentation.

  • See Also:
    setAlignment(int), setText(java.lang.String), setTextColor(java.awt.Color), Chart.setFont(java.awt.Font), Chart

    getLineAlignment

    public int getLineAlignment()

    Specifies the alignment of the constant line text relative to the constant line object.

    Values:
    StringAlignment : The StringAlignment type specifies how a string is aligned in reference to the bounding rectangle. A bounding rectangle is used to define the area in which the text displays.
    ValueDescription
    STRING_ALIGNMENT_NEARSpecifies that alignment is towards the origin of the bounding rectangle. May be used for alignment of characters along the line or for alignment of lines within the rectangle. For a right to left bounding rectangle, the origin is at the upper right.
    STRING_ALIGNMENT_CENTERSpecifies that alignment is centered between origin and extent (width) of the formatting rectangle.
    STRING_ALIGNMENT_FARSpecifies that alignment is to the far extent (right side) of the formatting rectangle.

    Remarks:
  • You need to specify the constant line text with setText(java.lang.String) property in order to see the alignment.

  • In order to create a constant line, you must first set the constant line value with the setValue(double) property and the axis it will be associated to with the setAxis(int) property.

  • To change the font for all constant lines in a chart, please refer to the setFont(java.awt.Font) property.

  • Use the setShowText(boolean) property to show or hide the constant line text.

  • In the following chart, the constant line LineAlignment has been set to StringAlignment.Center:

  • See Also:
    setAxis(int), setFont(java.awt.Font), setShowText(boolean), setText(java.lang.String), setValue(double), Stripe

    getLink

    public Link getLink()

    Gets the Link object for a selected ConstantLine item.

    Remarks:
  • Developers may obtain the Link object for an annotation item using this property. Using the supported Link class members, developers may configure a Link#setURL and Link.setTarget(java.lang.String) for the object.

  • See Also:
    Link.setUrl(java.lang.String), Link.setTarget(java.lang.String), Link

    getPoint

    public int getPoint()

    Gets or sets a value indicating the point a ConstantLine is associated.

    Remarks:
  • When utilizing the Highlight feature, developers may want to associate a SeriesAttributes or PointAttributeswith the ConstantLine. When that series or point is highlighted, the ConstantLine object will be highlighted as well.

  • You can also may also set this property equal to one of the HighlightState enumerations. Specifying Always indicates the constant line will always keep its highlighted state; Never indicates the constant line will never display a highlighted state.

  • See Also:
    setSeries(int), SeriesAttributes, PointAttributes

    getSeries

    public int getSeries()

    Gets or sets a value indicating the series a ConstantLine is associated.

    Remarks:
  • When utilizing the Highlight feature, developers may want to associate a SeriesAttributesor PointAttributes with the ConstantLine. When that series or point is highlighted, the ConstantLine object will be highlighted as well.

  • You can also may also set this property equal to on of the HighlightState enumerations. Specifying Always indicates the constant line will always keep its highlighted state; Never indicates the constant line will never display a highlighted state.

  • See Also:
    setPoint(int), SeriesAttributes, PointAttributes

    getStartCap

    public int getStartCap()

    Allows you to configure a marker shape at the beginning of a selected line.

    Values:
    LineCap : Specifies the available cap styles with which a line can end.
    ValueDescription
    ANCHOR_MASKSpecifies a mask used to check whether a line cap is an anchor cap.
    ARROW_ANCHORSpecifies an arrow-shaped anchor cap.
    CUSTOMSpecifies a custom line cap.
    DIAMOND_ANCHORSpecifies a diamond anchor cap.
    FLATSpecifies a flat line cap.
    NO_ANCHORSpecifies no anchor.
    ROUNDSpecifies a round line cap.
    ROUND_ANCHORSpecifies a round anchor cap.
    SQUARESpecifies a square line cap.
    SQUARE_ANCHORSpecifies a square anchor line cap.
    TRIANGLESpecifies a triangular line cap.

    Remarks:
  • When this property is applied to an axis line, both the primary and secondary axes are affected. For instance, when you change the X axis StartCap using this property both axes lines above and below the chart area are modified.

  • An ending marker shape may be applied to lines using the Line.setEndCap(int) property.

  • You can also control Line.setColor(java.awt.Color), Line.setStyle(int) and Line.setWidth(int) for a selected line object using the supported members of the Line .

  • See Also:
    Line.setEndCap(int), Line.setColor(java.awt.Color), Line.setStyle(int), Line.setWidth(int), Chart.getAxisX(), Chart.getAxisY(), Chart

    getStyle

    public int getStyle()

    Allows you to set the line style for a selected line.

    Values:
    DashStyle : Specifies the style with which dashed lines are drawn.
    ValueDescription
    CUSTOMSpecifies a user-defined custom dash style.
    DASHSpecifies a line consisting of dashes.
    DASH_DOTSpecifies a line consisting of a repeating pattern of dash-dot.
    DASH_DOT_DOTSpecifies a line consisting of a repeating pattern of dash-dot-dot.
    DOTSpecifies a line consisting of dots.
    SOLIDSpecifies a solid line.

    Remarks:
  • When this property is applied to an axis line, both the primary and secondary axes are affected. For instance, when you change the X axis line style using this property both axes lines above and below the chart area are effected.

  • You may also control the Line.setWidth(int) and Line.setColor(java.awt.Color) of the selected line using the supported members of the Line .

  • The Line.setEndCap(int) and Line.setStartCap(int) properties allow you to configured various shapes at the beginning and ending of a selected line.

  • The image below depicts a 'DashDotDot' Line style assigned to the Y axis:

  • See Also:
    Line.setEndCap(int), Line.setStartCap(int), Line.setColor(java.awt.Color), Line.setWidth(int), Chart.getAxisY(), Chart.getAxisX(), Chart.getConstantLines(), Chart, ConstantLine

    getText

    public java.lang.String getText()

    Used to set a text label for a selected constant line.

    Remarks:
  • When the constant line is associated with any of the Y axes, the default text alignment is Near (Left). On the other hand, if the label is associated with the X axis the default text alignment is Near (bottom). You can modify the text alignment with the setAlignment(int) property.

  • In order to create a constant line, you must first set the constant line value with the setValue(double) property and associate it with an axis using the setAxis(int) property.

  • To change the font for all constant lines in a chart, please refer to the setFont(java.awt.Font) property.

  • To highlight a range of values on a particular axis, please refer to the StripeStripe.

  • You can change the text color using the setTextColor(java.awt.Color) property.

  • See Also:
    setAlignment(int), setAxis(int), setTextColor(java.awt.Color), setValue(double), Title.setText(java.lang.String), Stripe

    getTextColor

    public java.awt.Color getTextColor()

    Used to change the text color for the constant line text.

    Remarks:
  • You can add text for the constant line using the setText(java.lang.String) property.

  • When the constant line is associated with any of the Y axes, the default text alignment is Near (Left). On the other hand, if the label is associated with the X axis the default text alignment is Near (bottom). You can modify the text alignment with the setAlignment(int) property.

  • In order to create a constant line, you must first set the constant line value with the setValue(double) property and associate it with an axis using the setAxis(int) property.

  • To change the font for all constant lines in a chart, please refer to the setFont(java.awt.Font) property.

  • To highlight a range of values on a particular axis, please refer to the StripeStripe.

  • For more information regarding the Color type, please refer to the Java API Documentation.

  • See Also:
    setAlignment(int), setAxis(int), setFont(java.awt.Font), setText(java.lang.String), setValue(double), Stripe

    getURL

    public java.lang.String getURL()
    Deprecated. You should use ConstantLine.getLink().getUrl instead.

    See Also:
    getLink()

    getValue

    public double getValue()

    Used to set a value for the selected constant line.

    Remarks:
  • The value of the constant goes in strict relationship with the Axis scale that is related to, as follows:

    - If the constant line is associated with a numerical axis, the value of the constant is a double according to the scale values set for that particular axis. Please remember a constant line may be associated to the X axis in an XY Plot where the X axis is a numerical axis with specific scale values.

    - If the constant line is associated with a categorical axis (X axis in charts other than XY Plots), the value is an integer specifying the point index you want to associate the constant line to. In these cases, the constant line will be drawn starting at the Major tick mark for the selected point.

  • Please note that if you set a constant line out of the range of the visible axis scale values, Chart FX will not recalculate the scale and you must set the Axis.setMin(double) or Axis.setMax(double) accordingly so the constant line can be seen.

    For example, if you set a value of 1000 for a constant line in the Y axis, while the Y axis scale is from 0 to 500. The constant line will not be visible and you must set a new maximum value using the Axis.setMax(double)property.

  • To highlight a range of values in a particular axis, please refer to the StripeStripe.

  • Here the ConstantLine value has been set to 150.75 on the Y Axis:

  • See Also:
    setAxis(int), Line.setColor(java.awt.Color), Line.setStyle(int), setText(java.lang.String), setTextColor(java.awt.Color), Stripe, Line

    getWidth

    public int getWidth()

    Gets or sets the line width for a selected line.

    Remarks:
  • When this property is applied to an axis line, both the primary and secondary axes are affected. For instance, when you change the X axis line width using this property both axes lines above and below the chart area are effected.

  • You may also control the Line.setStyle(int) and Line.setColor(java.awt.Color) of the selected line using the supported members of the Line .

  • The Line.setEndCap(int) and Line.setStartCap(int) properties allow you to configured various shapes at the beginning and ending of a selected line.

  • See Also:
    Line.setEndCap(int), Line.setStartCap(int), Line.setStyle(int), Line.setColor(java.awt.Color), Chart.getAxisY(), Chart.getAxisX(), Chart.getConstantLines(), Chart, ConstantLine

    isOutsideText

    public boolean isOutsideText()

    Allows you to position the constant line text outside the chart area.

    Remarks:
  • When this property is set to True, the text associated with the constant line is placed in the axis label area. (outside the charting area)

  • In the following chart, the constant line text is set as OutsideText:

  • See Also:
    setText(java.lang.String), setShowText(boolean), Chart

    isShowLine

    public boolean isShowLine()

    Allows you to show or hide a constant line in the chart.

    Remarks:
  • When you hide a constant line using this property, any text associated with the line will remain in the chart. Use the ShowText property to show or hide the constant line text.

  • See Also:
    setShowText(boolean), Stripe

    isShowText

    public boolean isShowText()

    Used to show or hide the constant line text in a chart.

    Remarks:
  • If you hide the text for a selected constant line, the constant line is still visible. To hide the constant line use the setShowLine(boolean) property.

  • To configure the constant line text outside the chart area, use the setOutsideText(boolean) property.

  • See Also:
    setOutsideText(boolean), setShowLine(boolean)

    setAlignment

    public void setAlignment(int value)

    Specifies the alignment for the constant line text relative to the configured X or Y axis.

    Values:
    StringAlignment : The StringAlignment type specifies how a string is aligned in reference to the bounding rectangle. A bounding rectangle is used to define the area in which the text displays.
    ValueDescription
    STRING_ALIGNMENT_NEARSpecifies that alignment is towards the origin of the bounding rectangle. May be used for alignment of characters along the line or for alignment of lines within the rectangle. For a right to left bounding rectangle, the origin is at the upper right.
    STRING_ALIGNMENT_CENTERSpecifies that alignment is centered between origin and extent (width) of the formatting rectangle.
    STRING_ALIGNMENT_FARSpecifies that alignment is to the far extent (right side) of the formatting rectangle.

    Remarks:
  • You need to specify the constant line text with setText(java.lang.String) property in order to see the alignment.

  • In order to create a constant line, you must first set the constant line value with the setValue(double) property and the axis associated with it using the setAxis(int) property.

  • To change the font for constant lines, please refer to the setFont(java.awt.Font) property.

  • To highlight a range of values in a particular axis, please refer to the StripeStripe.

  • In the following chart, the constant line Alignment has been set to StringAlignment.Center:

  • See Also:
    setAxis(int), setFont(java.awt.Font), setText(java.lang.String), setValue(double), Stripe

    setAxis

    public void setAxis(int value)

    Used to associate the selected constant line with one of the axes.

    Values:
    AxisItem : Allows Axis selection for properties needing axis assignment.
    ValueDescription
    YPrimary Y Axis.
    Y2Secondary Y Axis.
    XPrimary X Axis.
    X2Secondary X Axis.

    Remarks:
  • If no axis is specified, the default axis is the Y axis.

  • When assigned to any of the Y axes (left or right), the constant line will be a horizontal line that will cross the chart from left to right. When assigned to the X axis, the constant line will be a vertical line that will cross the chart from top to bottom.

  • Use the setValue(double) property to set where the constant line will be positioned on the X or Y axis.

  • It is common practice to label the constant line to indicate what it represents in the chart. For example, a constant line may show the text "Alarm Limit" so the user is aware of its importance. The label for a constant line can be set using the setText(java.lang.String) Property.

  • To highlight a range of values in a particular axis, please refer to the Stripe.

  • In this chart, the constant line has been configured to the X axis:

  • See Also:
    setAlignment(int), Line.setColor(java.awt.Color), Line.setStyle(int), setText(java.lang.String), setValue(double), Stripe, Line

    setColor

    public void setColor(java.awt.Color value)

    Allows you to set the line color for a selected line.

    Remarks:
  • When this property is applied to an axis line, both the primary and secondary axes are affected. For instance, when you change the X axis line color using this property both axes lines above and below the chart area are colored.

  • You may also control the Line.setWidth(int) and Line.setStyle(int) of the selected line using the supported members of the Line .

  • The Line.setEndCap(int) and Line.setStartCap(int) properties allow you to configured various shapes at the beginning and ending of a selected line.

  • For more information regarding the Color type, please refer to the Java API Documentation.

  • See Also:
    Line.setEndCap(int), Line.setStartCap(int), Line.setStyle(int), Line.setWidth(int), Chart.getAxisY(), Chart.getAxisX(), Chart.getConstantLines(), Chart, ConstantLine

    setEndCap

    public void setEndCap(int value)

    Allows you to configure a marker shape at the ending of a selected line.

    Values:
    LineCap : Specifies the available cap styles with which a line can end.
    ValueDescription
    ANCHOR_MASKSpecifies a mask used to check whether a line cap is an anchor cap.
    ARROW_ANCHORSpecifies an arrow-shaped anchor cap.
    CUSTOMSpecifies a custom line cap.
    DIAMOND_ANCHORSpecifies a diamond anchor cap.
    FLATSpecifies a flat line cap.
    NO_ANCHORSpecifies no anchor.
    ROUNDSpecifies a round line cap.
    ROUND_ANCHORSpecifies a round anchor cap.
    SQUARESpecifies a square line cap.
    SQUARE_ANCHORSpecifies a square anchor line cap.
    TRIANGLESpecifies a triangular line cap.

    Remarks:
  • When this property is applied to an axis line, both the primary and secondary axes are affected. For instance, when you change the X axis EndCap using this property both axes lines above and below the chart area are modified.

  • An starting marker shape may be applied to lines using the Line.setStartCap(int) property.

  • You can also control Line.setColor(java.awt.Color), Line.setStyle(int) and Line.setWidth(int) for a selected line object using the supported members of the Line .

  • See Also:
    Line.setStartCap(int), Line.setColor(java.awt.Color), Line.setStyle(int), Line.setWidth(int), Chart.getAxisX(), Chart.getAxisY(), Chart

    setFlags

    public void setFlags(int value)

    Used to control additional settings for the selected constant line.

    Values:
    ConstantFlag : ConstantLine enums.
    ValueDescription
    DEFAULTSets all constant line styles back to default.
    HIDE_TEXTDoes not display label associated with the selected constant line.
    HIDEHides the selected constant line and text.
    BACK_ONLYDraws constant line only in the background of the 3D wall when chart is in 3D mode.
    COLOR_TEXTMakes text color same color as constant line.
    HIDE_LINEHides the selected constant line.
    OUTSIDE_TEXTDisplays the text for the constant line outside the chart area.
    SHOW_VALUEDescription goes here

    Remarks:
  • This property is a word property. This means all settings represent a bit in the word that you need to turn on or off according to the desired result. For this purpose you need to use the bitwise operators (And, Or, Not, Xor) provided by your development tool.

    Because it is a word property, you must make sure you use these operators to turn on/off bits and avoid losing previous settings to the property.

    For example, if you want to use the ConstantFlag.HideText setting.

    The right way of setting this property is:

    chart1.getConstantLine(0).setFlags(chart1.getConstantLine(0).getFlags() | ConstantFlag.HIDE_TEXT);

    If you type the following code:

    chart1.getConstantLine(0).setFlags(ConstantFlag.HIDE_TEXT);

    (WRONG!)

    you will erase all other settings in the property causing an erratic behavior of the library.

  • See Also:
    setAxis(int), setFont(java.awt.Font), setText(java.lang.String), setTextColor(java.awt.Color), Axis.setStyle(int), Stripe, Axis, Line

    setFont

    public void setFont(java.awt.Font value)

    Allows you to modify the text font attributes for the selected constant line.

    Remarks:
  • You can set the font for the entire chart using the Chart class Chart.setFont(java.awt.Font) property.

  • When setting a font in Chart FX, you must create a new font object with the desired attributes and assign that object to the desired chart element every time you want to change the font.

  • For more information regarding the Font type, please refer to the Java API Documentation.

  • See Also:
    setAlignment(int), setText(java.lang.String), setTextColor(java.awt.Color), Chart.setFont(java.awt.Font), Chart

    setLineAlignment

    public void setLineAlignment(int value)

    Specifies the alignment of the constant line text relative to the constant line object.

    Values:
    StringAlignment : The StringAlignment type specifies how a string is aligned in reference to the bounding rectangle. A bounding rectangle is used to define the area in which the text displays.
    ValueDescription
    STRING_ALIGNMENT_NEARSpecifies that alignment is towards the origin of the bounding rectangle. May be used for alignment of characters along the line or for alignment of lines within the rectangle. For a right to left bounding rectangle, the origin is at the upper right.
    STRING_ALIGNMENT_CENTERSpecifies that alignment is centered between origin and extent (width) of the formatting rectangle.
    STRING_ALIGNMENT_FARSpecifies that alignment is to the far extent (right side) of the formatting rectangle.

    Remarks:
  • You need to specify the constant line text with setText(java.lang.String) property in order to see the alignment.

  • In order to create a constant line, you must first set the constant line value with the setValue(double) property and the axis it will be associated to with the setAxis(int) property.

  • To change the font for all constant lines in a chart, please refer to the setFont(java.awt.Font) property.

  • Use the setShowText(boolean) property to show or hide the constant line text.

  • In the following chart, the constant line LineAlignment has been set to StringAlignment.Center:

  • See Also:
    setAxis(int), setFont(java.awt.Font), setShowText(boolean), setText(java.lang.String), setValue(double), Stripe

    setOutsideText

    public void setOutsideText(boolean value)

    Allows you to position the constant line text outside the chart area.

    Remarks:
  • When this property is set to True, the text associated with the constant line is placed in the axis label area. (outside the charting area)

  • In the following chart, the constant line text is set as OutsideText:

  • See Also:
    setText(java.lang.String), setShowText(boolean), Chart

    setPoint

    public void setPoint(int value)

    Gets or sets a value indicating the point a ConstantLine is associated.

    Remarks:
  • When utilizing the Highlight feature, developers may want to associate a SeriesAttributes or PointAttributeswith the ConstantLine. When that series or point is highlighted, the ConstantLine object will be highlighted as well.

  • You can also may also set this property equal to one of the HighlightState enumerations. Specifying Always indicates the constant line will always keep its highlighted state; Never indicates the constant line will never display a highlighted state.

  • See Also:
    setSeries(int), SeriesAttributes, PointAttributes

    setSeries

    public void setSeries(int value)

    Gets or sets a value indicating the series a ConstantLine is associated.

    Remarks:
  • When utilizing the Highlight feature, developers may want to associate a SeriesAttributesor PointAttributes with the ConstantLine. When that series or point is highlighted, the ConstantLine object will be highlighted as well.

  • You can also may also set this property equal to on of the HighlightState enumerations. Specifying Always indicates the constant line will always keep its highlighted state; Never indicates the constant line will never display a highlighted state.

  • See Also:
    setPoint(int), SeriesAttributes, PointAttributes

    setShowLine

    public void setShowLine(boolean value)

    Allows you to show or hide a constant line in the chart.

    Remarks:
  • When you hide a constant line using this property, any text associated with the line will remain in the chart. Use the ShowText property to show or hide the constant line text.

  • See Also:
    setShowText(boolean), Stripe

    setShowText

    public void setShowText(boolean value)

    Used to show or hide the constant line text in a chart.

    Remarks:
  • If you hide the text for a selected constant line, the constant line is still visible. To hide the constant line use the setShowLine(boolean) property.

  • To configure the constant line text outside the chart area, use the setOutsideText(boolean) property.

  • See Also:
    setOutsideText(boolean), setShowLine(boolean)

    setStartCap

    public void setStartCap(int value)

    Allows you to configure a marker shape at the beginning of a selected line.

    Values:
    LineCap : Specifies the available cap styles with which a line can end.
    ValueDescription
    ANCHOR_MASKSpecifies a mask used to check whether a line cap is an anchor cap.
    ARROW_ANCHORSpecifies an arrow-shaped anchor cap.
    CUSTOMSpecifies a custom line cap.
    DIAMOND_ANCHORSpecifies a diamond anchor cap.
    FLATSpecifies a flat line cap.
    NO_ANCHORSpecifies no anchor.
    ROUNDSpecifies a round line cap.
    ROUND_ANCHORSpecifies a round anchor cap.
    SQUARESpecifies a square line cap.
    SQUARE_ANCHORSpecifies a square anchor line cap.
    TRIANGLESpecifies a triangular line cap.

    Remarks:
  • When this property is applied to an axis line, both the primary and secondary axes are affected. For instance, when you change the X axis StartCap using this property both axes lines above and below the chart area are modified.

  • An ending marker shape may be applied to lines using the Line.setEndCap(int) property.

  • You can also control Line.setColor(java.awt.Color), Line.setStyle(int) and Line.setWidth(int) for a selected line object using the supported members of the Line .

  • See Also:
    Line.setEndCap(int), Line.setColor(java.awt.Color), Line.setStyle(int), Line.setWidth(int), Chart.getAxisX(), Chart.getAxisY(), Chart

    setStyle

    public void setStyle(int value)

    Allows you to set the line style for a selected line.

    Values:
    DashStyle : Specifies the style with which dashed lines are drawn.
    ValueDescription
    CUSTOMSpecifies a user-defined custom dash style.
    DASHSpecifies a line consisting of dashes.
    DASH_DOTSpecifies a line consisting of a repeating pattern of dash-dot.
    DASH_DOT_DOTSpecifies a line consisting of a repeating pattern of dash-dot-dot.
    DOTSpecifies a line consisting of dots.
    SOLIDSpecifies a solid line.

    Remarks:
  • When this property is applied to an axis line, both the primary and secondary axes are affected. For instance, when you change the X axis line style using this property both axes lines above and below the chart area are effected.

  • You may also control the Line.setWidth(int) and Line.setColor(java.awt.Color) of the selected line using the supported members of the Line .

  • The Line.setEndCap(int) and Line.setStartCap(int) properties allow you to configured various shapes at the beginning and ending of a selected line.

  • The image below depicts a 'DashDotDot' Line style assigned to the Y axis:

  • See Also:
    Line.setEndCap(int), Line.setStartCap(int), Line.setColor(java.awt.Color), Line.setWidth(int), Chart.getAxisY(), Chart.getAxisX(), Chart.getConstantLines(), Chart, ConstantLine

    setText

    public void setText(java.lang.String value)

    Used to set a text label for a selected constant line.

    Remarks:
  • When the constant line is associated with any of the Y axes, the default text alignment is Near (Left). On the other hand, if the label is associated with the X axis the default text alignment is Near (bottom). You can modify the text alignment with the setAlignment(int) property.

  • In order to create a constant line, you must first set the constant line value with the setValue(double) property and associate it with an axis using the setAxis(int) property.

  • To change the font for all constant lines in a chart, please refer to the setFont(java.awt.Font) property.

  • To highlight a range of values on a particular axis, please refer to the StripeStripe.

  • You can change the text color using the setTextColor(java.awt.Color) property.

  • See Also:
    setAlignment(int), setAxis(int), setTextColor(java.awt.Color), setValue(double), Title.setText(java.lang.String), Stripe

    setTextColor

    public void setTextColor(java.awt.Color value)

    Used to change the text color for the constant line text.

    Remarks:
  • You can add text for the constant line using the setText(java.lang.String) property.

  • When the constant line is associated with any of the Y axes, the default text alignment is Near (Left). On the other hand, if the label is associated with the X axis the default text alignment is Near (bottom). You can modify the text alignment with the setAlignment(int) property.

  • In order to create a constant line, you must first set the constant line value with the setValue(double) property and associate it with an axis using the setAxis(int) property.

  • To change the font for all constant lines in a chart, please refer to the setFont(java.awt.Font) property.

  • To highlight a range of values on a particular axis, please refer to the StripeStripe.

  • For more information regarding the Color type, please refer to the Java API Documentation.

  • See Also:
    setAlignment(int), setAxis(int), setFont(java.awt.Font), setText(java.lang.String), setValue(double), Stripe

    setURL

    public void setURL(java.lang.String value)
    Deprecated. You should use ConstantLine.getLink().setUrl instead.

    See Also:
    getLink()

    setValue

    public void setValue(double value)

    Used to set a value for the selected constant line.

    Remarks:
  • The value of the constant goes in strict relationship with the Axis scale that is related to, as follows:

    - If the constant line is associated with a numerical axis, the value of the constant is a double according to the scale values set for that particular axis. Please remember a constant line may be associated to the X axis in an XY Plot where the X axis is a numerical axis with specific scale values.

    - If the constant line is associated with a categorical axis (X axis in charts other than XY Plots), the value is an integer specifying the point index you want to associate the constant line to. In these cases, the constant line will be drawn starting at the Major tick mark for the selected point.

  • Please note that if you set a constant line out of the range of the visible axis scale values, Chart FX will not recalculate the scale and you must set the Axis.setMin(double) or Axis.setMax(double) accordingly so the constant line can be seen.

    For example, if you set a value of 1000 for a constant line in the Y axis, while the Y axis scale is from 0 to 500. The constant line will not be visible and you must set a new maximum value using the Axis.setMax(double)property.

  • To highlight a range of values in a particular axis, please refer to the StripeStripe.

  • Here the ConstantLine value has been set to 150.75 on the Y Axis:

  • See Also:
    setAxis(int), Line.setColor(java.awt.Color), Line.setStyle(int), setText(java.lang.String), setTextColor(java.awt.Color), Stripe, Line

    setWidth

    public void setWidth(int value)

    Gets or sets the line width for a selected line.

    Remarks:
  • When this property is applied to an axis line, both the primary and secondary axes are affected. For instance, when you change the X axis line width using this property both axes lines above and below the chart area are effected.

  • You may also control the Line.setStyle(int) and Line.setColor(java.awt.Color) of the selected line using the supported members of the Line .

  • The Line.setEndCap(int) and Line.setStartCap(int) properties allow you to configured various shapes at the beginning and ending of a selected line.

  • See Also:
    Line.setEndCap(int), Line.setStartCap(int), Line.setStyle(int), Line.setColor(java.awt.Color), Chart.getAxisY(), Chart.getAxisX(), Chart.getConstantLines(), Chart, ConstantLine

    http://www.softwarefx.com

    2005 Software FX, Inc. All Rights Reserved. Chart FX is a registered trademark of Software FX, Inc
    All other names are trademarks or registered trademarks of their respective owners.