donatj / ticker-graph
Simple JavaScript Ticker Graph using the Quorum JS Installer
Package info
Language:JavaScript
Type:quorum-js
pkg:composer/donatj/ticker-graph
Requires
- quorum/installer: 1.*
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-05 22:22:19 UTC
README
Simple JavaScript Real Time "Ticker Graph"
Requires no external libraries.
Here are some more examples.
Install
npm install ticker-graph
Features
- Auto Scales to min and max values.
- Color set-able per column via callback.
- Set a color for an individual value when calling
push.
Example
To output a simple sine wave like so: 
<script src="lib/TickerGraph.js"></script> <canvas id="cv" width="100" height="40"></canvas> <script> const t = new TickerGraph( document.getElementById("cv") ); let i = 0; setInterval(function(){ t.push( Math.sin(i++ / 10) ); }, 20); </script>
Pass a color for a single value with push:
t.push(42, { color: "#f00" });
This color takes precedence over the graph's color or color callback for that value. Other values continue to use the graph's color or callback.
The graph keeps a reference to the options object. You can change its color
later. The change appears when the next push redraws the graph. Values that
share an options object will all use its updated color.
Get the current values from oldest to newest with getValues. It returns a new
array, so changes to the array do not affect the graph.
const values = t.getValues();
Use getLastValue to get the most recently pushed value. It returns null
before the first value is pushed.
const lastValue = t.getLastValue();
