View all files | ||||
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.
See pyglplot for the python equivalent of this library. However, please notice the python version is at its early stages.
Note: The canvas width and height must be set in order to be able to draw on the canvas.
Automatically arrange X values between [-1,1]:
Add the line to the webgl canvas:
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:
See examples on how to use this bundle in Codepen and JSfiddle
For ES6 module and direct browser import use:
and in your-code.js:
Thanks to TimDaub for testing the ES6 module.
Notice that this method is only recommended for test and small codes.
Skypack is a new exciting CDN for ESM Javascript. See the example below on how to use it: JSfiddle
Native Line and Thick Line.
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
MIT