
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
webgl-plot
Advanced tools
multi-line high-performance 2D graphs using native WebGL. The advantages are:
When plotting real-time multiple waveforms are required. For example, software-based oscilloscopes, Arduino, microcontrollers, FPGA user interfaces. This framework also can be used in combination with ElectronJS.
cannot change the line width due to the OpenGL implementation of a line. The OpenGL specification only guarantees a minimum of a single pixel line width. There are other solutions to increase the line width however they substantially increase the size of data vector and take a hit on the performance.
Initialization:
const canv = document.getElementById("my_canvas");
const devicePixelRatio = window.devicePixelRatio || 1;
const numX = Math.round(canv.clientWidth * devicePixelRatio);
const color = new webglplotBundle.ColorRGBA(Math.random(), Math.random(), Math.random(), 1);
const line = new webglplotBundle.WebglLine(color, numX);
const wglp = new webglplotBundle.WebGLplot(canv);
Add the line to webgl canvas:
line.linespaceX(-1, 2 / numX);
wglp.addLine(line);
Configure the requestAnimationFrame call:
function newFrame() {
update();
wglp.update();
window.requestAnimationFrame(newFrame);
}
window.requestAnimationFrame(newFrame);
Add the update function:
function update() {
const freq = 0.001;
const amp = 0.5;
const noise = 0.1;
for (let i = 0; i < line.numPoints; i++) {
const ySin = Math.sin(Math.PI * i * freq * Math.PI * 2);
const yNoise = Math.random() - 0.5;
line.setY(i, ySin * amp + yNoise * noise);
}
}
See this example in Codepen and JSfiddle
See examples at webgl-plot-examples
See here 📑
You can use WebUSB, Web Bluetooth, and Serial API. Examples will be provided soon.
npm i
npm run build
MIT
FAQs
High-performance 2D plotting library based on native WebGL
The npm package webgl-plot receives a total of 460 weekly downloads. As such, webgl-plot popularity was classified as not popular.
We found that webgl-plot demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.