IRenderEngine Interface
File
wijmo.chart.js
Module
wijmo.chart

Represents a rendering engine that performs the basic drawing routines.

Properties

cssPriority

Gets or sets the value that indicates css priority. By default, it's true and the specified css class has a priority over current engine's properties like fill or stroke.

Type
boolean

element

Gets the rendered element.

Type
Element

fill

Gets or sets the color used to fill the element.

Type
string

fontFamily

Gets or sets the font family for the text output.

Type
string

fontSize

Gets or sets the font size for the text output.

Type
string

stroke

Gets or sets the color used to outline the element.

Type
string

strokeWidth

Gets or sets the thickness of the outline.

Type
number

textFill

Gets or sets the text color.

Type
string

Methods

addClipRect

addClipRect(clipRect: Rect, id: string): void

Adds a clipping rectangle to the context.

Parameters
  • clipRect: Rect

    The clipping rectangle.

  • id: string

    The ID of the clipping rectangle.

Returns
void

beginRender

beginRender(): void

Clears the viewport and starts the rendering cycle.

Returns
void

drawDonutSegment

drawDonutSegment(cx: number, cy: number, radius: number, innerRadius: number, startAngle: number, sweepAngle: number, className?: string, style?: any, clipPath?: string): void

Draws a doughnut segment.

Parameters
  • cx: number

    X coordinate of the segment center.

  • cy: number

    Y coordinate of the segment center.

  • radius: number

    Outer radius of the segment.

  • innerRadius: number

    Inner radius of the segment.

  • startAngle: number

    Start angle of the segment, in degrees.

  • sweepAngle: number

    Sweep angle of the segment, in degrees clockwise.

  • className: string Optional

    Class name to be applied to the element.

  • style: any Optional

    Style object to be applied to the element.

  • clipPath: string Optional

    Id of the path to use as a clipping path.

Returns
void

drawEllipse

drawEllipse(cx: number, cy: number, rx: number, ry: number, className?: string, style?: any): void

Draws an ellipse.

Parameters
  • cx: number

    X coordinate of the ellipse's center.

  • cy: number

    Y coordinate of the ellipse's center.

  • rx: number

    X radius (half of the ellipse's width).

  • ry: number

    Y radius (half of the ellipse's height).

  • className: string Optional

    Class name to be applied to the element.

  • style: any Optional

    Style object to be applied to the element.

Returns
void

drawImage

drawImage(href: string, x: number, y: number, w: number, h: number): void

Draws an image.

Parameters
  • href: string

    Url of the image to draw.

  • x: number

    Left coordinate of the image's bounding rectangle.

  • y: number

    Bottom coordinate of the image's bounding rectangle.

  • w: number

    Image width.

  • h: number

    Image height.

Returns
void

drawLine

drawLine(x1: number, y1: number, x2: number, y2: number, className?: string, style?: any): void

Draws a line.

Parameters
  • x1: number

    X coordinate of the first point.

  • y1: number

    Y coordinate of the first point.

  • x2: number

    X coordinate of the second point.

  • y2: number

    Y coordinate of the second point.

  • className: string Optional

    Class name to be applied to the element.

  • style: any Optional

    Style object to be applied to the element.

Returns
void

drawLines

drawLines(xs: number[], ys: number[], className?: string, style?: any, clipPath?: string, num?: number): void

Draws a series of lines.

Parameters
  • xs: number[]

    Array of X coordinates.

  • ys: number[]

    Array of Y coordinates.

  • className: string Optional

    Class name to be applied to the element.

  • style: any Optional

    Style object to be applied to the element.

  • clipPath: string Optional

    Id of the path to use as a clipping path.

  • num: number Optional
Returns
void

drawPieSegment

drawPieSegment(cx: number, cy: number, radius: number, startAngle: number, sweepAngle: number, className?: string, style?: any, clipPath?: string): void

Draws a pie segment.

Parameters
  • cx: number

    X coordinate of the segment center.

  • cy: number

    Y coordinate of the segment center.

  • radius: number

    Radius of the segment.

  • startAngle: number

    Start angle of the segment, in degrees.

  • sweepAngle: number

    Sweep angle of the segment, in degrees clockwise.

  • className: string Optional

    Class name to be applied to the element.

  • style: any Optional

    Style object to be applied to the element.

  • clipPath: string Optional

    Id of the path to use as a clipping path.

Returns
void

drawPolygon

drawPolygon(xs: number[], ys: number[], className?: string, style?: any, clipPath?: string): void

Draws a polygon.

Parameters
  • xs: number[]

    Array of X coordinates.

  • ys: number[]

    Array of Y coordinates.

  • className: string Optional

    Class name to be applied to the element.

  • style: any Optional

    Style object to be applied to the element.

  • clipPath: string Optional

    Id of the path to use as a clipping path.

Returns
void

drawRect

drawRect(x: number, y: number, w: number, h: number, className?: string, style?: any, clipPath?: string): void

Draws a rectangle.

Parameters
  • x: number

    Left of the rectangle.

  • y: number

    Bottom of the rectangle.

  • w: number

    Width of the rectangle.

  • h: number

    Height of the rectangle.

  • className: string Optional

    Class name to be applied to the element.

  • style: any Optional

    Style object to be applied to the element.

  • clipPath: string Optional

    Id of the path to use as a clipping path.

Returns
void

drawSplines

drawSplines(xs: number[], ys: number[], className?: string, style?: any, clipPath?: string, num?: number): void

Draws a series of splines (smooth path).

Parameters
  • xs: number[]

    Array of X coordinates.

  • ys: number[]

    Array of Y coordinates.

  • className: string Optional

    Class name to be applied to the element.

  • style: any Optional

    Style object to be applied to the element.

  • clipPath: string Optional

    Id of the path to use as a clipping path.

  • num: number Optional
Returns
void

drawString

drawString(s: string, pt: Point, className?: string, style?: any): void

Draws a string.

Parameters
  • s: string

    String to be drawn.

  • pt: Point

    Reference point for the string.

  • className: string Optional

    Class name to be applied to the element.

  • style: any Optional

    Style object to be applied to the element.

Returns
void

drawStringRotated

drawStringRotated(s: string, pt: Point, center: Point, angle: number, className?: string, style?: any): void

Draws a rotated string.

Parameters
  • s: string

    String to be drawn.

  • pt: Point

    Reference point for rendering the string.

  • center: Point

    Reference point for rotating the string.

  • angle: number

    Rotation angle, in degrees, clockwise.

  • className: string Optional

    Class name to be applied to the element.

  • style: any Optional

    Style object to be applied to the element.

Returns
void

endGroup

endGroup(): void

Ends a group.

Returns
void

endRender

endRender(): void

Finishes the rendering cycle.

Returns
void

measureString

measureString(s: string, className?: string, groupName?: string, style?: any): Size

Measures a string.

Parameters
  • s: string

    String to be measured.

  • className: string Optional

    Class name to use when measuring the string.

  • groupName: string Optional

    Name of the group to use when measuring the string.

  • style: any Optional

    Style object to use when measuring the string.

Returns
Size

setViewportSize

setViewportSize(w: number, h: number): void

Sets the size of the viewport.

Parameters
Returns
void

startGroup

startGroup(className?: string, clipPath?: string, createTransform?: boolean): void

Starts a group.

Parameters
  • className: string Optional

    Class name to apply to the new group.

  • clipPath: string Optional

    Id of the path to use as a clipping path.

  • createTransform: boolean Optional

    Whether to create a new transform for the group.

Returns
void