Home Reference Source
import BaseGauge from 'canvas-gauges/lib/BaseGauge.js'
public class | source

BaseGauge

Direct Subclass:

LinearGauge, RadialGauge

Basic abstract BaseGauge class implementing common functionality for different type of gauges.

It should not be instantiated directly but must be extended by a final gauge implementation.

Example:


class MyCoolGauge extends BaseGauge {

    // theses methods below MUST be implemented:

    constructor(options) {
       // ... do something with options
       super(options);
       // ... implement anything else
    }

    draw() {
        // ... some implementation here
        return this;
    }
}

Static Method Summary

Static Public Methods
public static

initialize(Type: string, options: GenericOptions)

Inject given gauge object into DOM

Constructor Summary

Public Constructor
public abstract

Member Summary

Public Members
public
public
public

Gauge options

public

Gauge type class

public set

value(value: number): *

Sets new value for this gauge.

public get

Returns current value of the gauge

Method Summary

Public Methods
public

Performs destruction of this object properly

public abstract

Triggering gauge render on a canvas.

public

Updates gauge configuration options at runtime and redraws the gauge

Static Public Methods

public static initialize(Type: string, options: GenericOptions) source

Inject given gauge object into DOM

Params:

NameTypeAttributeDescription
Type string
options GenericOptions

Public Constructors

public abstract constructor(options: GenericOptions) source

Params:

NameTypeAttributeDescription
options GenericOptions

Public Members

public animation: Animation source

public canvas: SmartCanvas source

public options: GenericOptions source

Gauge options

public type: BaseGauge source

Gauge type class

public set value(value: number): * source

Sets new value for this gauge. If gauge is animated by configuration it will trigger a proper animation. Upsetting a value triggers gauge redraw.

public get value: number: * source

Returns current value of the gauge

Return:

number

Public Methods

public destroy() source

Performs destruction of this object properly

public abstract draw(): BaseGauge source

Triggering gauge render on a canvas.

Return:

BaseGauge

public update(options: RadialGaugeOptions): BaseGauge source

Updates gauge configuration options at runtime and redraws the gauge

Params:

NameTypeAttributeDescription
options RadialGaugeOptions

Return:

BaseGauge