Function
Static Public Summary | ||
public |
Gauge collections type. |
|
public |
drawShadow(context: Canvas2DContext, options: GenericOptions, shadowDrawn: boolean): boolean Draws the shadow if it was not drawn |
|
public |
drawValueBox(context: Canvas2DContext, options: GenericOptions, value: number | string, x: number, y: number, max: number) Draws value box at given position |
|
public |
font(options: GenericOptions, target: string, baseSize: number): * Constructs font styles for canvas fonts |
|
public |
formatContext(options: GenericOptions | any, format: string): string Format string unit string format using option members Format option to set the “units” attribute. |
|
public |
formatMajorTickNumber(num: number, options: object): string Formats a number for display on the dial's plate using the majorTicksFormat config option. |
|
public |
linearGradient(context: Canvas2DContext, colorFrom: string, colorTo: string, length: number, isVertical: boolean, from: number): CanvasGradient Creates and returns linear gradient canvas object |
|
public |
normalizedValue(options: GenericOptions): {normal: number, indented: number} Returns normalized value |
|
public |
Pads a given value with leading zeros using the given options |
|
public |
radialPoint(radius: number, angle: number): {x: number, y: number} Calculates and returns radial point coordinates |
|
public |
Transforms degrees to radians |
|
public |
Draws rounded corners rectangle |
|
public |
Look-ups for a proper vendor-specific property and returns its value |
|
public |
verifyError(err: Error) Examines if a given error is something to throw or to ignore |
Static Public
public Collection() source
import Collection from 'canvas-gauges/lib/Collection.js'
Gauge collections type.
It is used ES5 declaration here, because babel transpiles inheritance incorrectly in this case.
public drawShadow(context: Canvas2DContext, options: GenericOptions, shadowDrawn: boolean): boolean source
import {drawShadow} from 'canvas-gauges/lib/drawings.js'
Draws the shadow if it was not drawn
Params:
Name | Type | Attribute | Description |
context | Canvas2DContext | ||
options | GenericOptions | ||
shadowDrawn | boolean |
public drawValueBox(context: Canvas2DContext, options: GenericOptions, value: number | string, x: number, y: number, max: number) source
import {drawValueBox} from 'canvas-gauges/lib/drawings.js'
Draws value box at given position
public font(options: GenericOptions, target: string, baseSize: number): * source
import {font} from 'canvas-gauges/lib/drawings.js'
Constructs font styles for canvas fonts
Params:
Name | Type | Attribute | Description |
options | GenericOptions | ||
target | string | ||
baseSize | number |
Return:
* |
public formatContext(options: GenericOptions | any, format: string): string source
import {formatContext} from 'canvas-gauges/lib/drawings.js'
Format string unit string format using option members Format option to set the “units” attribute. For example “{value} % {title}” which replaces the attributes inside {} to the same member in the option object. So if title is set to “Hour” and value to “50” the units will be “50% Hour”.
Params:
Name | Type | Attribute | Description |
options | GenericOptions | any | ||
format | string |
public formatMajorTickNumber(num: number, options: object): string source
import {formatMajorTickNumber} from 'canvas-gauges/lib/drawings.js'
Formats a number for display on the dial's plate using the majorTicksFormat config option.
public linearGradient(context: Canvas2DContext, colorFrom: string, colorTo: string, length: number, isVertical: boolean, from: number): CanvasGradient source
import {linearGradient} from 'canvas-gauges/lib/drawings.js'
Creates and returns linear gradient canvas object
Return:
CanvasGradient |
public normalizedValue(options: GenericOptions): {normal: number, indented: number} source
import {normalizedValue} from 'canvas-gauges/lib/drawings.js'
Returns normalized value
Params:
Name | Type | Attribute | Description |
options | GenericOptions |
public padValue(val: number, options: RadialGaugeOptions | {valueInt: number, valueDec: number}): string source
import {padValue} from 'canvas-gauges/lib/drawings.js'
Pads a given value with leading zeros using the given options
Params:
Name | Type | Attribute | Description |
val | number | ||
options | RadialGaugeOptions | {valueInt: number, valueDec: number} |
public radialPoint(radius: number, angle: number): {x: number, y: number} source
import {radialPoint} from 'canvas-gauges/lib/drawings.js'
Calculates and returns radial point coordinates
public radians(degrees: number): number source
import {radians} from 'canvas-gauges/lib/drawings.js'
Transforms degrees to radians
Params:
Name | Type | Attribute | Description |
degrees | number |
public roundRect(context: Canvas2DContext, x: number, y: number, w: number, h: number, r: number) source
import {roundRect} from 'canvas-gauges/lib/drawings.js'
Draws rounded corners rectangle
public vendorize(prop: string, from: HTMLElement | Window | object): * source
import vendorize from 'canvas-gauges/lib/vendorize.js'
Look-ups for a proper vendor-specific property and returns its value
Return:
* |
Example:
var requestAnimationFrame = vendorize('requestAnimationFrame');
// it will refer properly to:
// - window.requestAnimationFrame by default or to
// - window.webkitRequestAnimationFrame or to
// - window.mozRequestAnimationFrame or to
// - window.msRequestAnimationFrame or to
// - window.oRequestAnimationFrame
// depending on the current browser vendor
public verifyError(err: Error) source
import {verifyError} from 'canvas-gauges/lib/drawings.js'
Examines if a given error is something to throw or to ignore
Params:
Name | Type | Attribute | Description |
err | Error |