# Class: Component
core.Component
Base class representing objects which have a visual representation on the canvas. This is mostly analogous to the Artist (opens new window) class in matplotlib.
# Hierarchy
# Table of contents
# Constructors
# Properties
# Constructors
# constructor
• new Component(canvas
, draw?
)
# Parameters
Name | Type | Description |
---|---|---|
canvas | ResponsiveCanvas | ResponsiveCanvas instance. |
draw | (context : CanvasRenderingContext2D ) => void | Draw function. |
# Defined in
core/Component.ts:21 (opens new window)
# Properties
# canvas
• canvas: ResponsiveCanvas
The canvas which the component is attached to.
# Defined in
core/Component.ts:11 (opens new window)
# draw
• draw: (context
: CanvasRenderingContext2D
) => void
# Type declaration
▸ (context
): void
Function which draws the component on the canvas.
# Parameters
Name | Type |
---|---|
context | CanvasRenderingContext2D |
# Returns
void