drawTextPixel()

ICE Data Services -

drawTextPixel()

 

drawTextPixel(xBar, yValue, Text, [FGColor], [BGColor], [Flags], [FontName], [FontSize], [TagName], [cx], [cy])

 

This function is used to draw text on the chart at precise pixel locations. It is used in conjunction with the getTextHeight() and getTextWidth() functions.

 

  • xBar:  Relative position where text should appear.
  • yValue:  y-axis value where text should appear
  • Text:  The text that should be displayed
  • FGColor:  Optional. If not provided, pass null. Foreground color of the text.
  • BGColor:  Optional. if not provided, pass null. Background color of the text
  • Flags:  Text Flags (these can be ORd together). Pass null if not using flags.
  • FontName:  Optional. If not provided, pass null. Otherwise, pass a font name (e.g, "Courier" or "Arial").
  • FontSize:  Optional. If not provided, pass null. Otherwise, pass the font size to use (e.g., 11 or 15 or 8, etc.)
  • TagName:  A unique identifier for this text object.
  • cx:   Optional. Pixel spacing control.
  • cy:   Optional. Pixel spacing control.

 

Note re cx/cy:

 

The cx and cy parameters control the width (cx) and height (cy) of the text label. They are also available in the drawTextRelative and drawTextAbsolute functions, but are not very useful unless you are using them in combination with text flags, RELATIVETOTOP, RELATIVETOLEFT and RELATIVETOBOTTOM. 
Both cx and cy require whole numbers.

You can pass positive or negative numbers to these parameters.  If you use positive whole numbers then the size is based on that number of pixels.  

    - cx of 15 will be the width of the text label of 15 pixels.
    - cy of 15 will be the height of the text label of 15 pixels.
If you use negative whole numbers then the size is relative to the specified font size.  

    - cx of -15 will be the approximate width of 15 characters of the specified font.
    - cy of -2 will be 2 times the height of the specified font. -3 would be 3 times the height etc.

    - cy == 0 uses size of text.

 

See PixelSpacingEx.efs in the Help Examples from the EFS Library for a detailed formula example.

 

drawText Flags

Colors 

getTextHeight()

getTextWidth()