Skip to content

ChartArea.DrawVerticalLine

method · ChartArea · cAlgo.API

DesktopCLICloud

Draws a vertical line.

Environment behaviour

CLI — works differently. The object is created and returned, but never drawn: the CLI displays no chart.

Cloud — works differently. The object is created and returned, but never drawn: the cloud displays no chart.

Overloads

DrawVerticalLine(string name, DateTime time, Color color)

Draws a vertical line.

ChartVerticalLine DrawVerticalLine(string name, DateTime time, Color color)
chartArea.DrawVerticalLine(name: str, time: DateTime, color: Color) -> ChartVerticalLine

Parameters

Name C# type Python type Description
name string str The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
time DateTime DateTime The time value on the X-axis.
color Color Color The line color.

Returns ChartVerticalLine — ChartVerticalLine.

Examples

var line = Chart.DrawVerticalLine("today", Server.Time.Date, Color.Gray);
Print("Vertical line drawn at {0}", line.Time);
line = api.Chart.DrawVerticalLine("today", api.Server.Time.Date, Color.Gray)
api.Print(f"Vertical line drawn at {line.Time}")

DrawVerticalLine(string name, DateTime time, Color color, int thickness)

Draws a vertical line.

ChartVerticalLine DrawVerticalLine(string name, DateTime time, Color color, int thickness)
chartArea.DrawVerticalLine(name: str, time: DateTime, color: Color, thickness: int) -> ChartVerticalLine

Parameters

Name C# type Python type Description
name string str The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
time DateTime DateTime The time value of the line location on the X-axis.
color Color Color The line color.
thickness int int The line thickness.

Returns ChartVerticalLine — ChartVerticalLine.

Examples

var line = Chart.DrawVerticalLine("today", Server.Time.Date, Color.Gray, 2);
Print("Vertical line drawn at {0} with thickness {1}", line.Time, line.Thickness);
line = api.Chart.DrawVerticalLine("today", api.Server.Time.Date, Color.Gray, 2)
api.Print(f"Vertical line drawn at {line.Time} with thickness {line.Thickness}")

DrawVerticalLine(string name, DateTime time, Color color, int thickness, LineStyle lineStyle)

Draws a vertical line.

ChartVerticalLine DrawVerticalLine(string name, DateTime time, Color color, int thickness, LineStyle lineStyle)
chartArea.DrawVerticalLine(name: str, time: DateTime, color: Color, thickness: int, lineStyle: LineStyle) -> ChartVerticalLine

Parameters

Name C# type Python type Description
name string str The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
time DateTime DateTime The time value of the line location on the X-axis.
color Color Color The line color.
thickness int int The line thickness.
lineStyle LineStyle LineStyle The line style.

Returns ChartVerticalLine — ChartVerticalLine.

Examples

var line = Chart.DrawVerticalLine("today", Server.Time.Date, Color.Gray, 1, LineStyle.DotsRare);
Print("Vertical line drawn at {0} with style {1}", line.Time, line.LineStyle);
line = api.Chart.DrawVerticalLine("today", api.Server.Time.Date, Color.Gray, 1, LineStyle.DotsRare)
api.Print(f"Vertical line drawn at {line.Time} with style {line.LineStyle}")

DrawVerticalLine(string name, int barIndex, Color color)

Draws a vertical line.

ChartVerticalLine DrawVerticalLine(string name, int barIndex, Color color)
chartArea.DrawVerticalLine(name: str, barIndex: int, color: Color) -> ChartVerticalLine

Parameters

Name C# type Python type Description
name string str The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
barIndex int int The bar index of the line location on the X-axis.
color Color Color The line color.

Returns ChartVerticalLine — ChartVerticalLine.

Examples

var line = Chart.DrawVerticalLine("lastBar", Bars.Count - 1, Color.Gray);
Print("Vertical line drawn at {0}", line.Time);
line = api.Chart.DrawVerticalLine("lastBar", api.Bars.Count - 1, Color.Gray)
api.Print(f"Vertical line drawn at {line.Time}")

DrawVerticalLine(string name, int barIndex, Color color, int thickness)

Draws a vertical line.

ChartVerticalLine DrawVerticalLine(string name, int barIndex, Color color, int thickness)
chartArea.DrawVerticalLine(name: str, barIndex: int, color: Color, thickness: int) -> ChartVerticalLine

Parameters

Name C# type Python type Description
name string str The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
barIndex int int The bar index of the line location on the X-axis.
color Color Color The line color.
thickness int int The line thickness.

Returns ChartVerticalLine — ChartVerticalLine.

Examples

var line = Chart.DrawVerticalLine("lastBar", Bars.Count - 1, Color.Gray, 2);
Print("Vertical line drawn at {0} with thickness {1}", line.Time, line.Thickness);
line = api.Chart.DrawVerticalLine("lastBar", api.Bars.Count - 1, Color.Gray, 2)
api.Print(f"Vertical line drawn at {line.Time} with thickness {line.Thickness}")

DrawVerticalLine(string name, int barIndex, Color color, int thickness, LineStyle lineStyle)

Draws a vertical line.

ChartVerticalLine DrawVerticalLine(string name, int barIndex, Color color, int thickness, LineStyle lineStyle)
chartArea.DrawVerticalLine(name: str, barIndex: int, color: Color, thickness: int, lineStyle: LineStyle) -> ChartVerticalLine

Parameters

Name C# type Python type Description
name string str The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
barIndex int int The bar index of the line location on the X-axis.
color Color Color The line color.
thickness int int The line thickness.
lineStyle LineStyle LineStyle The line style.

Returns ChartVerticalLine

Examples

var line = Chart.DrawVerticalLine("lastBar", Bars.Count - 1, Color.Gray, 1, LineStyle.Dots);
Print("Vertical line drawn at {0} with style {1}", line.Time, line.LineStyle);
line = api.Chart.DrawVerticalLine("lastBar", api.Bars.Count - 1, Color.Gray, 1, LineStyle.Dots)
api.Print(f"Vertical line drawn at {line.Time} with style {line.LineStyle}")