Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
webgl-plot
Advanced tools
multi-line high-performance 2D plotting library using native WebGL. The advantages are:
Dynamic: 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.
Static: Enables rapid pan and zoom capability for inspecting very large datasets. See the static example
However notice that due to computation of the line data points, the performance of the thick lines is nearly 6 times slower than the normal lines. Only use thick lines when you need to see the lines clearly for example when highlighting a specific line. Further information can be found below. For benchmarking, see the benchmark section.
next
coming soon 🎉The next version is currently under development. More computation is moved to the GPU, significantly improving performance. These improvements specifically benefit the rolling plot and the scatter plot. However, these changes require a rewrite of the main library and migration to webgl2
. The current version will remain as no maintenance is needed since it is based on pure javascript. See an example here.
See pyglplot for the python equivalent of this library. However, please notice the python version is at its early stages.
<div>
<canvas style="width: 100%;" id="my_canvas"></canvas>
</div>
webgl-plot
library using ES6 modules:import { WebglPlot, WebglLine, ColorRGBA } from "webgl-plot";
const canvas = document.getElementById("my_canvas");
const devicePixelRatio = window.devicePixelRatio || 1;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
Note: The canvas width and height must be set in order to be able to draw on the canvas.
const numX = canvas.width;
const color = new ColorRGBA(Math.random(), Math.random(), Math.random(), 1);
const line = new WebglLine(color, numX);
const wglp = new WebglPlot(canvas);
Automatically arrange X values between [-1,1]:
line.arrangeX();
Add the line to the webgl canvas:
wglp.addLine(line);
function newFrame() {
update();
wglp.update();
requestAnimationFrame(newFrame);
}
requestAnimationFrame(newFrame);
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);
}
}
Don't forget to update the canvas with wglp.update()
each time you want to redraw the changes that you have made to the line objects.
See examples based on vanilla JS at webgl-plot-examples
See examples based on React
See SPAD Simulation which use WebGL-Plot as an oscilloscope display
For a basic React example see here:
React website is under development...
https://webgl-plot-react.vercel.app/ ⚛
To use WebGL-Plot as a JS pre-bundled package first import the following in your HTML file:
<script src="https://cdn.jsdelivr.net/gh/danchitnis/webgl-plot@master/dist/webglplot.umd.min.js"></script>
See examples on how to use this bundle in Codepen and JSfiddle
For ES6 module and direct browser import use:
<script type="module" src="your-code.js"></script>
and in your-code.js:
import { WebglPlot, WebglLine, ColorRGBA } from "<http source>";
You can use web-based bundlers such as esm.sh, unpkng, JSdeliver ,and jspm to import the library to get the appropriate http source
. See an example here:
JSfiddle
Thanks to TimDaub for testing the ES6 module.
Native Line and Thick Line.
See Benchmark for more detailed analysis.
ESM, off-screen, UMD
See here 📑
You can use WebUSB, Web Bluetooth, and Serial API. You can use ComPort for a basic implementation of Serial API
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 559 weekly downloads. As such, webgl-plot popularity was classified as not popular.
We found that webgl-plot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.