a collection of graphics and drawing related utility functions used by the chart classes

Constructors

Methods

  • get approximate line height from css font definition currently only supports px and pt

    Parameters

    • font: string

    Returns number

  • draw activity indicator

    Parameters

    • context: BGContext
    • cx: number
    • cy: number
    • radius: number
    • segments: number
    • style: { [key: string]: any }
    • step: number

      initially should be zero; later pass in return value when drawing again

    Returns number

  • Draws a border using the specified object style configuration

    Parameters

    • ctx: BGContext
    • x: number

      The top left x coordinate

    • y: number

      The top left y coordinate

    • w: number

      The width of the rectangle

    • h: number

      The height of the rectangle

    • style: { [key: string]: any }
    • Optionaloutside: boolean
    • OptionalmaxX: number
    • OptionalmaxY: number

    Returns void

  • draw an ellipse

    Parameters

    • context: BGContext
    • cx: number

      the center x coordinate

    • cy: number

      the center y coordinate

    • width: number
    • height: number

    Returns void

  • draw a simple triangular arrow

    Parameters

    • context: BGContext
    • x: number

      The top left x coordinate

    • y: number

      The top left y coordinate

    • Optionalwidth: number
    • Optionalheight: number
    • Optionalright: boolean

      should the arrow be facing right or left?

    Returns void

  • Parameters

    • context: BGContext
    • x: number
    • y: number
    • h: number
    • dir: number
    • value: string
    • color: string
    • textColor: null | string
    • font: string

    Returns void

  • draw line with specified style

    Parameters

    • context: BGContext
    • x: number
    • y: number
    • x2: number
    • y2: number
    • style: ELineType | "dotted" | "default" | "dashed"
    • Optionalshift: number

    Returns void

  • Draws a rounded rectangle using the current state of the canvas. If you omit the last three params, it will draw a rectangle outline with a 5 pixel border radius

    Parameters

    • ctx: BGContext
    • x: number

      The top left x coordinate

    • y: number

      The top left y coordinate

    • width: number

      The width of the rectangle

    • height: number

      The height of the rectangle

    • Optionalradius: number

      The corner radius. Defaults to 5;

    • Optionalfill: boolean

      Whether to fill the rectangle. Defaults to false.

    • Optionalstroke: boolean

      Whether to stroke the rectangle. Defaults to true.

    Returns void

  • draw a tooltip with originating from the supplied rectangle,

    Parameters

    • context: BGContext
    • rx: number

      upper left x coordinate

    • ry: number

      upper left y coordinate

    • rw: number

      width of rectangle

    • rh: number

      height of rectangle

    • text: string
    • style: { [key: string]: any }
    • bounds: Bounds

      optional bounds limiting the area to draw in

    Returns void

  • Parameters

    • context: BGContext
    • text: string
    • x: number
    • y: number
    • maxWidth: number
    • style: { "background-color": string; "border-color": string; "text-color": string }
    • bounds: Bounds

    Returns void

  • draw a simple triangular arrow

    Parameters

    • context: BGContext
    • x: number

      The top left x coordinate

    • y: number

      The top left y coordinate

    • Optionalwidth: number
    • Optionalheight: number
    • Optionalup: boolean

      should the arrow be facing up or down?

    Returns void

  • Parameters

    • context: BGContext
    • x: number
    • y: number
    • w: number
    • dir: number
    • value: string
    • color: string
    • textColor: null | string
    • font: string

    Returns void

  • Parameters

    • context: BGContext
    • text: string
    • x: number
    • y: number
    • maxWidth: number
    • OptionalcalculateOnly: boolean

    Returns number

  • retrieve pixel ratio zoom level is taken into account on most browsers

    Parameters

    • Optionalview: any

    Returns number