<line>

<line> is a Graphical component that renders a line when nested inside a <graph> component, and renders an equation otherwise.

Current functionality supports generation of lines in R2\mathbb{R^2} through user-specification of:

  1. a single pair of points
  2. through a single point and a specified slope
  3. with an equation, or <function>

Attributes and Properties

Attributes for <line>
AttributeTypeValues
applyStyleToLabel = "…"boolean"true" "false"
displayDecimals = "…"integer
displayDigits = "…"integer
displaySmallAsZero = "…"number
draggable = "…"boolean"true" "false"
equation = "…"math
labelIsName = "…"boolean"true" "false"
labelPosition = "…"text"upperright" "upperleft" "lowerright" "lowerleft"
layer = "…"integer
padZeros = "…"boolean"true" "false"
parallelTo = "…"
perpendicularTo = "…"
slope = "…"math
through = "…"
variables = "…"[ _variableName ]
Props for <line name="l">
PropertyType
$l.applyStyleToLabelboolean
$l.backgroundColortext
$l.coeff0math
$l.coeffvar1math
$l.coeffvar2math
$l.disabledboolean
$l.displayDecimalsinteger
$l.displayDigitsinteger
$l.displaySmallAsZeronumber
$l.draggableboolean
$l.equationmath
$l.fixedboolean
$l.fixLocationboolean
$l.hiddenboolean
$l.labellabel
$l.labelIsNameboolean
$l.labelPositiontext
$l.latexlatex
$l.layerinteger
$l.numDimensionsnumber
$l.padZerosboolean
$l.points[ math ]
$l.slopemath
$l.styleDescriptiontext
$l.styleDescriptionWithNountext
$l.texttext
$l.textColortext
$l.textStyleDescriptiontext
$l.variables[ _variableName ]
$l.xinterceptmath
$l.yinterceptmath

Example: Default <line>

The default <line> without any attributes specified (other than a styleNumber) is illustrated. This line is not very interesting; it is just the xx-axis. The equation of the line is copied below the <graph>. You can click and drag the line to see this equation updated.


Example: <line> with slope and through point

Two lines are graphed using both the slope and through attributes.


Example: <line> through 2 points

Two lines are graphed by specifying two through points using the through attribute.


Example: <line> by equation

Two lines are graphed by providing their equations directly.


Example: Line as a <function>

Two lines are defined using the <function> component. This is a useful alternative to defining a line with the <line> component if the function needs to be evaluated at different input values.


Attribute Example: through

Two lines are graphed by specifying two through points using the through attribute.


Attribute Example: slope

If only the slope attribute is specified, the yy-intercept defaults to (0,0)(0,0).


Attribute Example: equation

The equation attribute takes any linear expression in xx and yy, unless the variables attribute is also employed.


Attribute Example: variables

The variables attribute allows customization of the independent and dependent variable names.


Attribute Example: Standard graphical attributes

The uses of the following standard graphical attributes are illustrated: hide, draggable, layer, styleNumber, applyStyleToLabel and labelIsName.


Property Example: Attributes as properties

The above listed attributes of a named <line> are also available as properties.


Property Example: points

The points property of a named <line> returns the through points of the line in an array.


Property Example: xIntercept, yIntercept

The xIntercept and yIntercept properties return the intercepts of the named <line>.


Property Example: coeff0, coeffVar1, coeffVar2

Linear coefficients corresponding to the linear form Ax+By+C=0A x + B y + C = 0 can be obtained with the above properties, where C=C = coeff0, B=B = coeffVar2 and A=A = coeffVar1.


Property Example: latex

The latex property renders the latex code for rendering the equation of the line.