npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gl-error-bars

v2.2.2

Published

Draws error bars around points

Downloads

1

Readme

gl-error-bars

Draws error bars around scatter points.

Example

var shell           = require('gl-now')({ clearColor: [0,0,0,0] })
var camera          = require('game-shell-orbit-camera')(shell)
var createAxes      = require('gl-axes')
var createErrorBars = require('gl-error-bars')
var mat4            = require('gl-mat4')

var bounds = [[-5,-5,-5], [5,5,5]]
var errorbars, axes

shell.on('gl-init', function() {
  var gl = shell.gl

  camera.lookAt(bounds[1], [0,0,0], [0, 1, 0])

  axes = createAxes(gl, {
    bounds: bounds
  })

  errorbars = createErrorBars(gl, {
    position: [
      [0,0,0],
      [0,2,0],
      [-2,-3,0]
    ],

    error: [
      [[-0.5,-0.5,-0.1], [0.5,0.5,0.5]],
      [[0,0,0], [0.5,0.5,0.5]],
      [[-0.5,-0.5,0], [0,0,0]]
    ],

    color: [
      [1,0,0],
      [0,1,0],
      [0,0,1]
    ]
  })
})

shell.on('gl-render', function() {
  var gl = shell.gl
  gl.enable(gl.DEPTH_TEST)

  var cameraParameters = {
    view: camera.view(),
    projection: mat4.perspective(
        mat4.create(),
        Math.PI/4.0,
        shell.width/shell.height,
        0.1,
        1000.0)
  }

  axes.draw(cameraParameters)
  errorbars.draw(cameraParameters)
})

API

Constructor

var errorBars = require('gl-error-bars')(gl, options)

Creates a new error bar object.

  • gl is a WebGL context
  • object is a collection of properties which are used to initialize the object

Returns A new error bar object

Methods

errorBars.draw(camera)

Draws the error bars

  • camera is an object storing the parameters to draw

    • camera.model is the model matrix
    • camera.view is the view matrix
    • camera.projection is the projection matrix

errorBars.update(options)

Updates the error bar object

  • position is the position of each point in the plot
  • error is an array of error bounds represented as [lo,hi] for each point
  • color a length 3 array of arrays giving the color of the error bars along each axis.
  • lineWidth is the width of the error bar lines in pixels
  • capSize is the size of the cap for error bars
  • clipBounds is a box to which all error bars will be clipped

errorBars.dispose()

Destroy the error bars and release all associated resources

errorBars.bounds

Bounds on the error bar object for display purposes

Credits

(c) 2014 Mikola Lysenko. MIT License