Abstract
Abstract base for gauge presentation strategies.
A strategy receives a GaugeRenderContext and must return a GaugeRenderOutput — either an SVGSVGElement (kind: 'svg') or raw ImageData (kind: 'imagedata').
SVGSVGElement
kind: 'svg'
ImageData
kind: 'imagedata'
Built-in implementations:
class MyCustomStrategy extends GaugePresentationStrategy { public readonly name = 'Custom'; public render(ctx: GaugeRenderContext): GaugeRenderOutput { const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); // … draw your gauge … return { kind: 'svg', element: svg }; }} Copy
class MyCustomStrategy extends GaugePresentationStrategy { public readonly name = 'Custom'; public render(ctx: GaugeRenderContext): GaugeRenderOutput { const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); // … draw your gauge … return { kind: 'svg', element: svg }; }}
Readonly
Human-readable name for this strategy (e.g. "Analog", "VU Meter").
"Analog"
"VU Meter"
Render the gauge into an SVG element or raw ImageData.
Pre-validated render context.
An SVG element or raw ImageData.
Abstract base for gauge presentation strategies.
A strategy receives a GaugeRenderContext and must return a GaugeRenderOutput — either an
SVGSVGElement(kind: 'svg') or rawImageData(kind: 'imagedata').Built-in implementations:
Example