regl-scatter2d

WebJar for regl-scatter2d

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

regl-scatter2d
Last Version

Last Version

3.1.8
Release Date

Release Date

Type

Type

jar
Description

Description

regl-scatter2d
WebJar for regl-scatter2d
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/gl-vis/regl-scatter2d

Download regl-scatter2d

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/regl-scatter2d/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>regl-scatter2d</artifactId>
    <version>3.1.8</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/regl-scatter2d/
implementation 'org.webjars.npm:regl-scatter2d:3.1.8'
// https://jarcasting.com/artifacts/org.webjars.npm/regl-scatter2d/
implementation ("org.webjars.npm:regl-scatter2d:3.1.8")
'org.webjars.npm:regl-scatter2d:jar:3.1.8'
<dependency org="org.webjars.npm" name="regl-scatter2d" rev="3.1.8">
  <artifact name="regl-scatter2d" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='regl-scatter2d', version='3.1.8')
)
libraryDependencies += "org.webjars.npm" % "regl-scatter2d" % "3.1.8"
[org.webjars.npm/regl-scatter2d "3.1.8"]

Dependencies

compile (16)

Group / Artifact Type Version
org.webjars.npm : point-cluster jar [3.1.8,4)
org.webjars.npm : to-float32 jar [1.0.1,2)
org.webjars.npm : clamp jar [1.0.1,2)
org.webjars.npm : is-iexplorer jar [1.0.0,2)
org.webjars.npm : object-assign jar [4.1.1,5)
org.webjars.npm : parse-rect jar [1.2.0,2)
org.webjars.npm : color-normalize jar [1.5.0]
org.webjars.npm : color-id jar [1.1.0,2)
org.webjars.npm : array-range jar [1.0.1,2)
org.webjars.npm » image-palette jar [2.1.0,3)
org.webjars.npm : color-rgba jar [2.1.1,3)
org.webjars.npm : update-diff jar [1.1.0,2)
org.webjars.npm : pick-by-alias jar [1.2.0,2)
org.webjars.npm : array-rearrange jar [2.2.2,3)
org.webjars.npm : glslify jar [7.0.0,8)
org.webjars.npm : flatten-vertex-data jar [1.0.2,2)

Project Modules

There are no modules declared in this project.

regl-scatter2d unstable Build Status

Fast and precise 2d scatter plot for lots of points.

regl-scatter2d

Remake on gl-scatter2d, covering other scatter-related components.

Demo.

Usage

npm install regl-scatter2d

let regl = require('regl')({extensions: 'oes_element_index_uint'})

let createScatter = require('regl-scatter2d')

let scatter = createScatter(regl)

//draw 5 points
scatter({
  positions: [0,0, 1,0, 2,0, 1,1, 2,1],
  color: 'rgba(0, 100, 200, .75)'
})

createScatter(regl)

Create new scatter plot instance from regl. regl instance should have OES_element_index_uint extension enabled.

scatter(optionsA, optionsB, ...rest)

Draw scatter points corresponding to options.

// render multiple point groups
scatter(
  { points: [0,0, 1,1], color: 'blue', marker: null },
  { points: [0,1, 1,0], color: 'red', marker: someSdf }
)
Option Default Description
positions, points [] An array of the unrolled xy coordinates of the points as [x,y, x,y, ...points] or array of points [[x,y], [x,y], ...points]. Can be an object with {x: [...xValues], y: [...yValues]} planar values. For more precise memory control, like in matrix case, x or y can be an object of the form {x: {buffer: reglBuffer, offset: value}}, then the reglBuffer will be reused.
size, sizes 12 Number or array with marker sizes in pixels. Array length should correspond to positions.
borderSize, borderSizes 1 Number or array with border sizes in pixels. Array length should correspond to positions.
color, colors 'black' Color or array with colors. Each color can be a css color string or an array with float 0..1 values.
borderColor, borderColors 'transparent' Border color or array with border colors.
opacity 1 Regulate marker transparency separately from colors.
marker, markers null Marker SDF image, should be a rectangular array with 0..1 1-channel values of signed distance field. Use bitmap-sdf or svg-path-sdf to generate distance array from a canvas, image or svg. .5 value of distance corresponds to the border line. If null, circular marker is used.
range, dataBox null Data bounds limiting visible data as [left, top, right, bottom]. If null, the range is detected as positions boundaries.
viewport, viewBox null Bounding box limiting visible area within the canvas in pixels, can be an array [left, top, right, bottom] or an object {left, top, right, bottom} or {x, y, w, h}.
snap null A bool, number of points threshold to enable snapping or point-cluster tree instance.

scatter.update(optionsA, optionsB, ...rest)

Update options corresponding to passes, not incurring redraw. Passing null will remove previously loaded pass.

// update 3 passes
scatter.update(a, b, c)

// update 1st pass, remove 2nd pass, ignore 3rd pass
scatter.update(a, null)

// update 2nd pass (former 3rd pass)
scatter.update(null, b)

// update n-th pass
scatter.update.apply(scatter, Array.from({length: 10, 9: options}))

scatter.draw(id1|els1?, id2|els2?, ...)

Draw groups corresponding to ids, optionally specify marker ids to draw via els:

// create 3 groups of points
scatter.update(
  {points: [0,1, 1,0], color: 'red', marker: squareSdf},
  {points: [1,2, 2,1], color: 'green', marker: triangleSdf},
  {points: [0,0, 1,1], color: 'blue', marker: null}
)

// draw all groups
scatter.draw()

// draw red group
scatter.draw(0)

// draw green and blue group
scatter.draw(1, 2)

// draw the second point of the blue group and the first point of the red group
scatter.draw([1], null, [0])

scatter.destroy()

Dispose scatter instance and associated resources.

Related

Similar

License

© 2017 Dmitry Yv. MIT License

Development supported by plot.ly.

org.webjars.npm

Versions

Version
3.1.8
3.1.7
3.1.4
3.1.3
3.0.6
2.1.17