Class: BarChartDisplay

BarChartDisplay

Display a bar chart from an incomming vector input.

Constructor

new BarChartDisplay(options)

Parameters:
Name Type Description
options Object

Override default parameters.

Properties
Name Type Attributes Default Description
colors String <optional>
null

Colors of the bars.

min Number <optional>
-80

Minimum displayed value.

max Number <optional>
6

Maximum displayed value.

width Number <optional>
300

Width of the canvas. dynamic parameter

height Number <optional>
150

Height of the canvas. dynamic parameter

container Element | CSSSelector <optional>
null

Container element in which to insert the canvas. constant parameter

canvas Element | CSSSelector <optional>
null

Canvas element in which to draw. constant parameter

Source:
Example
import * as lfo from 'waves-lfo/client';
import * as lfo from 'waves-lfo/client';

const frameSize = 5;
const dt = 0.02;

const eventIn = new lfo.source.EventIn({
  frameSize: frameSize,
  frameRate: 1 / dt,
  frameType: 'vector',
});

const barChart = new lfo.sink.BarChartDisplay({
  canvas: '#bar-chart',
});

eventIn.connect(barChart);
eventIn.start();

const data = [0, 0.2, 0.4, 0.6, 0.8];

(function generateData() {
  for (let i = 0; i < frameSize; i++)
    data[i] = (data[i] + 0.001) % 1;

  eventIn.process(null, data);

  setTimeout(generateData, dt * 1000);
}());