Skip to content

Line

class cAlgo.API

DesktopCLICloud

Represents the line shape.

Environment behaviour

CLI — not supported. Accepted without error but never displayed, so control events such as Click are never raised.

Cloud — not supported. Accepted without error but never displayed, so control events such as Click are never raised.

Definition

public class Line : Shape

Namespace: cAlgo.API · Group: Shapes · Inherits: Shape, ControlBase

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to draw a line shape on your chart
    public partial class LineShapeSample : Indicator
    {
        protected override void Initialize()
        {
            var xCenter = Chart.Width / 2;
            var yCenter = Chart.Height / 2;

            var line = new Line
            {
                X1 = xCenter,
                X2 = xCenter + 100,
                Y1 = yCenter,
                Y2 = yCenter + 100,
                StrokeColor = Color.Red,
                StrokeThickness = 2
            };

            Chart.AddControl(line);
        }

        public override void Calculate(int index)
        {
        }
    }
}
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        xCenter = api.Chart.Width / 2
        yCenter = api.Chart.Height / 2

        line = Line()
        line.X1 = xCenter
        line.X2 = xCenter + 100
        line.Y1 = yCenter
        line.Y2 = yCenter + 100
        line.StrokeColor = Color.Red
        line.StrokeThickness = 2

        api.Chart.AddControl(line)
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}

Constructors

Name Description
LineDesktopCLICloud Initializes a new instance of the Line class.

Properties

Name Description
X1DesktopCLIClouddouble Gets or sets x-axis point 1 data.
X2DesktopCLIClouddouble Gets or sets the x-axis point 2 data.
Y1DesktopCLIClouddouble Gets or sets the y-axis point 2 data.
Y2DesktopCLIClouddouble Gets or sets the y-axis point 2 data.

Inherited members

From Shape: StrokeColor, FillColor, StrokeThickness, Stretch, StrokeEndLineCap, StrokeStartLineCap, StrokeLineJoin, StrokeMiterLimit, StrokeDashArray, StrokeDashOffset, StrokeDashCap

From ControlBase: ResetProperty, UniqueId, Style, Left, Top, Right, Bottom, Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight, IsEnabled, IsVisible, Opacity, Margin, VerticalAlignment, HorizontalAlignment, Dock, IsHitTestVisible