webgl-plot
Advanced tools
Comparing version 0.1.9 to 0.2.0
@@ -19,6 +19,6 @@ "use strict"; | ||
__extends(WebglLine, _super); | ||
function WebglLine(c, num) { | ||
function WebglLine(c, numPoints) { | ||
var _this = _super.call(this) || this; | ||
_this.webglNumPoints = num; | ||
_this.numPoints = num; | ||
_this.webglNumPoints = numPoints; | ||
_this.numPoints = numPoints; | ||
_this.color = c; | ||
@@ -45,6 +45,6 @@ _this.intenisty = 1; | ||
}; | ||
WebglLine.prototype.linespaceX = function () { | ||
WebglLine.prototype.linespaceX = function (start, stepsize) { | ||
for (var i = 0; i < this.numPoints; i++) { | ||
// set x to -num/2:1:+num/2 | ||
this.setX(i, 2 * i / this.numPoints - 1); | ||
this.setX(i, start + stepsize * i); | ||
} | ||
@@ -51,0 +51,0 @@ }; |
@@ -42,7 +42,7 @@ "use strict"; | ||
}; | ||
WebglStep.prototype.linespaceX = function () { | ||
WebglStep.prototype.linespaceX = function (start, stepsize) { | ||
for (var i = 0; i < this.numPoints; i++) { | ||
// set x to -num/2:1:+num/2 | ||
this.xy[i * 4] = 2 * (i / this.numPoints) - 1; | ||
this.xy[i * 4 + 2] = 2 * ((i + 1) / this.numPoints) - 1; | ||
this.xy[i * 4] = start + (i * stepsize); | ||
this.xy[i * 4 + 2] = start + (i * stepsize + stepsize); | ||
} | ||
@@ -49,0 +49,0 @@ }; |
{ | ||
"name": "webgl-plot", | ||
"version": "0.1.9", | ||
"version": "0.2.0", | ||
"description": "High-performance 2D plotting framework based on native WebGL", | ||
@@ -9,3 +9,3 @@ "main": "./dist/index", | ||
"devDependencies": { | ||
"typescript": "^3.7.2" | ||
"typescript": "^3.7.3" | ||
}, | ||
@@ -12,0 +12,0 @@ "scripts": { |
@@ -11,18 +11,23 @@ ![Build Action](https://github.com/danchitnis/webgl-plot/workflows/Build/badge.svg "") | ||
* Full control over the color of each line in each frame | ||
* Works on any browser/platfrom that [supports WebGL](https://caniuse.com/#feat=webgl) | ||
What are the use cases? | ||
---- | ||
## What are the use cases? | ||
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. | ||
## Limitations | ||
cannot change the line width due to the OpenGL implementation of 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. | ||
### Build | ||
```sh | ||
$ npm run build | ||
``` | ||
## Getting started | ||
See examples at [webgl-plot-examples](https://github.com/danchitnis/webgl-plot-examples) | ||
## Build | ||
```bash | ||
npm i | ||
npm run build | ||
``` | ||
License | ||
---- | ||
##License | ||
MIT | ||
@@ -16,6 +16,6 @@ | ||
constructor(c: ColorRGBA, num: number) { | ||
constructor(c: ColorRGBA, numPoints: number) { | ||
super(); | ||
this.webglNumPoints = num; | ||
this.numPoints = num; | ||
this.webglNumPoints = numPoints; | ||
this.numPoints = numPoints; | ||
this.color = c; | ||
@@ -46,6 +46,6 @@ this.intenisty = 1; | ||
public linespaceX() { | ||
public linespaceX(start: number, stepsize: number) { | ||
for (let i = 0; i < this.numPoints; i++) { | ||
// set x to -num/2:1:+num/2 | ||
this.setX(i, 2 * i / this.numPoints - 1); | ||
this.setX(i, start + stepsize * i); | ||
} | ||
@@ -52,0 +52,0 @@ } |
@@ -37,7 +37,7 @@ | ||
public linespaceX() { | ||
public linespaceX(start: number, stepsize: number) { | ||
for (let i = 0; i < this.numPoints; i++) { | ||
// set x to -num/2:1:+num/2 | ||
this.xy[i * 4] = 2 * (i / this.numPoints) - 1; | ||
this.xy[i * 4 + 2] = 2 * ((i+1) / this.numPoints) - 1; | ||
this.xy[i * 4] = start + (i * stepsize); | ||
this.xy[i * 4 + 2] = start + (i * stepsize + stepsize); | ||
} | ||
@@ -44,0 +44,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45954
24
705
33