Search Framework:
DrawingObjectLine
Namespace: WealthLab.ChartWPF
Parent: Object

Represents a component line in a chart drawing object. A DrawingObjectLine is defined by two Handle instances and provides properties that control its appearance, visibility, extension, and interaction behavior.

Constructors
DrawingObjectLine
public DrawingObjectLine(DrawingObjectBase parent)

Creates a new DrawingObjectLine associated with the DrawingObjectBase instance specified in parent. The line is initially visible.



Members
CanChangeExtendLeft
public bool CanChangeExtendLeft

Controls whether the ExtendLeft property of this line is changed when the user changes the "Extend Left" Parameter of the Parent drawing object. The default value is true.


CanChangeExtendRight
public bool CanChangeExtendRight

Controls whether the ExtendRight property of this line is changed when the user changes the "Extend Right" Parameter of the Parent drawing object. The default value is true.


CanChangeLineStyle
public bool CanChangeLineStyle

Controls whether the LineStyle property of this line is changed when the user changes the "Line Style" Parameter of the Parent drawing object. The default value is true.


Color
public WLColor Color

Specifies an optional color for the line. The default value is WLColor.Empty. Drawing objects can use this property to allow individual component lines to be rendered in a different color than the parent drawing object.


Extend
public bool Extend

Returns true if either ExtendLeft or ExtendRight is true.


ExtendLeft
public bool ExtendLeft

Controls whether the line extends to the left beyond its LeftHandle when rendered.


ExtendRight
public bool ExtendRight

Controls whether the line extends to the right beyond its RightHandle when rendered.


FixHandleOrder
public void FixHandleOrder()

Ensures that Handle1 occurs before Handle2 on the chart. If the Index of Handle1 is greater than the Index of Handle2, the DateTime and Value properties of the two handles are swapped.


Handle1
public Handle Handle1

One of the two Handle instances that define the line.


Handle2
public Handle Handle2

One of the two Handle instances that define the line.


InViewport
public bool InViewport(int startX, int endX)
public bool InViewport(int x)

Determines whether the line is visible within a specified range of chart bar indices, taking the ExtendLeft and ExtendRight settings into account. The first version returns true if the line, or an extended portion of it, intersects the range from startX through endX. The second version determines whether the line extends through the single bar index specified in x.


IsDraggable
public bool IsDraggable

Controls whether the user can drag the line with the mouse.


IsMouseOver
public bool IsMouseOver(Point pt)

Returns true if the mouse position specified in pt is considered to be over the line. The method returns false if IsDraggable is false. For non-vertical lines, a mouse position within approximately 5 pixels of the line is considered to be over it.


IsVertical
public bool IsVertical

Returns true if Handle1 and Handle2 have the same DateTime.


IsVisible
public bool IsVisible

Controls whether the line should be rendered. A newly constructed DrawingObjectLine is visible by default.


LeftHandle
public Handle LeftHandle

Returns the Handle that occurs on the left side of the line, based on the handles' Index values. If both handles have the same Index, Handle1 is returned.


LineStyle
public LineStyle LineStyle

Specifies the LineStyle used when rendering the line. The default value is LineStyle.Solid.


LineWidth
public int LineWidth

Specifies the width of the line. The default value is 2.


Parent
public DrawingObjectBase Parent

Returns the DrawingObjectBase instance that this line belongs to.


Parse
public void Parse(string s)

Restores the state of the DrawingObjectLine from the persisted string specified in s. The persisted handle references are resolved against the Handles collection of the Parent drawing object.


Persist
public string Persist()

Returns a string containing the persisted state of the DrawingObjectLine, including its handles, drag state, line style, extension settings, visibility, color, and line width.


Render
public void Render(DrawingContext dc, Pen pen)

Renders the line to the specified DrawingContext (dc) using the specified pen. If ExtendLeft or ExtendRight is enabled, the line is extended toward the corresponding edge of the chart. The line is not rendered if IsVisible is false.


RightHandle
public Handle RightHandle

Returns the Handle that occurs on the right side of the line, based on the handles' Index values. If both handles have the same Index, Handle2 is returned.


SolveForY
public double SolveForY(DateTime dt)

Returns the y-axis value at which the line intersects the DateTime specified in dt. Returns Double.NaN if the required chart coordinate conversion cannot be performed. For a vertical line, the method returns the Value of Handle1.


StreamingValue
public double StreamingValue

Returns the projected y-axis value of the line at the next streaming bar position. This is calculated by extending the slope defined by Handle1 and Handle2 one bar beyond the chart's current EndIndex. Returns Double.NaN if the value cannot be calculated.