NinjaScript > Language Reference > Drawing >

DrawText()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
Draws text.

 

Method Return Value

An IText object that represents the draw object.

 

Syntax

DrawText(string tag, string text, int barsAgo, double y, Color color)
DrawText(string tag, bool autoScale, string text, int barsAgo, double y, int yPixelOffset, Color textColor, Font font, StringAlignment alignment, Color outlineColor, Color areaColor, int areaOpacity)

DrawText(string tag, bool autoScale, string text, DateTime time, double y, int yPixelOffset, Color textColor, Font font, StringAlignment alignment, Color outlineColor, Color areaColor, int areaOpacity)

 

Parameters

tag

A user defined unique id used to reference the draw object. For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time.

autoScale

Determines if the draw object will be included in the y-axis scale. Default value is false.

text

The text you wish to draw

barsAgo

The bar (x axis co-ordinate) where the draw object will be drawn. For example, a value of 10 would paint the draw object 10 bars back.

time

The time where the draw object will be drawn.

y

The y co-ordinate location the object will be drawn

yPixelOffset

The offset value in pixels from within the text box area

textColor

The draw object color (reference)

font

The type of font used (reference). Default is Arial 8px.

alignment

StringAlignment.Center
StringAlignment.Far
StringAlignment.Near
(reference)

outlineColor

Text box outline color (reference)

areaColor

Text box fill color (reference)

areaOpacity

Sets the level of transparency for the fill color. Valid values between 0 - 10. (0 = completely transparent, 10 = no opacity)

 

 

 

Examples

// Draws text
DrawText("tag1", "Text to draw", 10, 1000, Color.Black);