# regl-error2d

> Render error bars for the set of points

Latest version **2.0.12** (published 2021-06-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install regl-error2d
pnpm add regl-error2d
yarn add regl-error2d
bun add regl-error2d
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.12 |
| Published | 2021-06-29 |
| First published | 2017-11-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 18.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Dima Yv |
| Maintainers | plotlysteve, jmmease, chriddyp, verazabeida, bpostlethwaite, alexcjohnson, nicolaskruchten, antrg, archmoj, xhlu, emmanuelle, rpkyle, andrefarzat, hammadtheone, dfcreative, etpinard, dy |
| Keywords | regl, plotly |

## Links

- npm: https://www.npmjs.com/package/regl-error2d
- Repository: https://github.com/dy/regl-error2d
- Homepage: https://github.com/dy/regl-error2d#readme
- Issues: https://github.com/dy/regl-error2d/issues
- npm.io page: https://npm.io/package/regl-error2d

## Dependencies (7)

- [to-float32](https://npm.io/package/to-float32.md) ^1.1.0
- [update-diff](https://npm.io/package/update-diff.md) ^1.1.0
- [array-bounds](https://npm.io/package/array-bounds.md) ^1.0.1
- [object-assign](https://npm.io/package/object-assign.md) ^4.1.1
- [pick-by-alias](https://npm.io/package/pick-by-alias.md) ^1.2.0
- [color-normalize](https://npm.io/package/color-normalize.md) ^1.5.0
- [flatten-vertex-data](https://npm.io/package/flatten-vertex-data.md) ^1.0.2

## Recent versions

- 2.0.12 (latest) — 2021-06-29
- 2.0.11 — 2020-08-17
- 2.0.10 — 2020-07-28
- 2.0.8 — 2019-07-02
- 2.0.7 — 2019-04-06
- 2.0.6 — 2019-01-16
- 2.0.5 — 2018-05-01
- 2.0.4 — 2018-01-05
- 2.0.3 — 2017-12-01
- 2.0.2 — 2017-11-30
- 2.0.1 — 2017-11-10
- 2.0.0 — 2017-11-01

## README

# regl-error2d [![experimental](https://img.shields.io/badge/stability-unstable-green.svg)](http://github.com/badges/stability-badges)

Draw error bars for a set of points with regl.

![regl-error2d](https://github.com/dy/regl-error2d/blob/master/preview.png?raw=true)

Remake on [gl-error2d](https://github.com/gl-vis/gl-error2d):

* `color` may define per-bar colors.
* max number of points extended 40 times (from `1e5` to `4e6`) via instanced draw.
* `lineWidth` and `capSize` are adjusted to actual pixels.
* enhanced performance via vertex shader.

[Demo](https://dy.github.io/regl-error2d).

## Usage

[![npm install regl-error2d](https://nodei.co/npm/regl-error2d.png?mini=true)](https://npmjs.org/package/regl-error2d/)

```js
let regl = require('regl')({extensions: 'angle_instanced_arrays'})
let createError2d = require('regl-error2d')

let error2d = createError2d(regl)

error2d({
  positions: [0,0, .5,0, ...],
  errors: [.5,.5,.5,.6, .2,.3,.4,.1, ...],
  color: 'rgba(0, 100, 200, .75)'
})
```

### `createError2d(regl, options?)`

Create new error2d instance from `regl` and initial `options`. Note that `regl` instance should have `ANGLE_instanced_arrays` extension enabled.

### `error2d(options|list?)`

Draw errors, update options.

Option | Default | Description
---|---|---
`positions`, `points`, `data` | `[]` | An array of unrolled xy coordinates of the points as `[x,y, x,y, ...]` or array of points `[[x,y], [x,y], ...]`.
`errors`, `error` | `[]` | Array with error values corresponding to the points `[e0l,e0r,e0b,e0t, e1l,e1r,e1b,e1t, ...]`
`capSize`, `cap` | `5` | Error bar cap size, in pixels
`lineWidth`, `thickness` | `1` | Error bar line width, in pixels
`color`, `colors` | `'red'` | Color or array with colors. Each color can be a css color string or an array with float `0..1` values.
`opacity` | `1` | Error bars opacity.
`range`, `dataBox` | `null` | Visible data range.
`viewport`, `viewBox` | `null` | Output area within the canvas.

A list of options can be passed for batch rendering:

```js
error2d([options1, options2, ...])
```

### `error2d.update(options|list)`

Update options, not incurring redraw.

### `error2d.draw(id?)`

Draw errors based on last options. `id` integer can specify a list item to redraw from batch update.

### `error2d.destroy()`

Dispose error2d and associated resources.


## License

(c) 2017 Dima Yv. MIT License

Development supported by plot.ly.

---
_Source: https://npm.io/package/regl-error2d · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
