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

visual-heatmap

v2.1.0

Published

"Advanced Visual Heatmap - High Scale webGL based rendering."

Downloads

2,001

Readme

Visual-Heatmap Js npm Downloads

Visual Heatmap, an open-source JavaScript module, emerges as a powerful tool designed to render large-scale heatmaps with exceptional performance. This framework is based on advanced graphical rendering - WebGL/Shaders. It can render 500,000+ data points with a good framerate.

Examples:

Installing

npm

npm i visual-heatmap --save

Or Download source code from below links

Usage

Importing

Visual-Heatmap offers both ES6 and UMD modules, making it possible to integrate the module into applications as needed.

import Heatmap from 'visual-heatmap'

Instance Creation API

visualHeatmap provides a API to create heatmap instance. API accepts container/containerId and config as an input. A context element will be created under the provided Div #containerId.

let instance = Heatmap('#containerId', {
        size: 30.0,  //Radius of the data point, in pixels. Default: 20
        max: 100,  // if not set, will be derived from data
        min: 0,  // if not set, will be derived from data
        intensity: 1.0, 
        background: {
            url: "urlPath",
            width: 100, // if not set, viewport width of the image will be considered
            height: 100, // if not set, viewport height of the image will be considered
            x: 0,
            y: 0
        },
        gradient: [{
            color: [0, 0, 255, 1.0],
            offset: 0
        }, {
            color: [0, 0, 255, 1.0],
            offset: 0.2
        }, {
            color: [0, 255, 0, 1.0],
            offset: 0.45
        }, {
            color: [255, 255, 0, 1.0],
            offset: 0.85
        }, {
            color: [255, 0, 0, 1.0],
            offset: 1.0
        }]
    });

Container/ContainerId : The container div element or a string CSS Query selector which identifies the container.

Config Object :

{
     size : Radius of the data point, in pixels. Default: 20
     max : Max data Value for relative gradient computation. if not set, will be derived from data.
     min : Min data Value for relative gradient computation. if not set, will be derived from data.
     intensity : intensity factor. Default: 1.0
     opacity : Opacity factor. Default: 1.0
     rotationAngle : Rotation angle. Default: 0
     translate : translate vector [x, y]. Default: [0,0]
     zoom : Zoom Factor. Default: 1.0
     gradient : Color Gradient, array of objects with color value and offset.
     background: To set background of the heatMap. Value : { url: , x: , y: , height: , width: }
}

Adding Data API

instance.renderData([])

Accepts an array of data points with 'x', 'y' and 'value'. Demo

instance.renderData([{x: , y: , value: }])

instance.addData([], transformationIntactflag);

Accepts an array of data points with 'x', 'y' and 'value' and a boolean flag to specify to apply existing heatmap transformations on the newly added data points. After adding data points, need to invoke .render() method to update the heatmap. Try Example

instance.addData([{x: , y: , value: }],transformationIntactflag)

Render API

Method to re-render the heatmap. This method needs to be invoked as and when configurations get changed. Example

instance.render()

Configuration Setting API

instance.setMax(number)

To set max data value, for relative gradient calculations.

instance.setMin(number)

To set min data value, for relative gradient calculations.

instance.setTranslate([number, number])

Api to perform translate transformation on the canvas. Accepts array[x, y] as an input. Try Example

instance.setZoom(number)

Api to perform zoom transformation on the canvas. Accepts float value as an input. Try Example

instance.setRotationAngle(number)

Api to perform rotation transformation on the canvas. Accepts angle in radians. Try Example

instance.setSize(number)

Api to set point radius. Accepts float value as an input. Try Example

instance.setGradient(gradient)

Api to set color gradient. Accepts array of objects with color value and offset.

instance.setIntensity(number)

Api to set Intensity factor. Accepts float value as an input. Try Example

instance.setOpacity(number)

Api to set Opacity factor. Accepts float value as an input. Try Example

instance.setBackgroundImage({ url: , x: , y: , height: , width: })

Api to set Background image. Accepts Object with { Url, height, width, x, and y} properties as input Try Example

instance.projection({x: , y: })

Api to get projected co-ordinates relative to the heatmap layer. Try Example

instance.resize()

Api to rerender heatmep on parent container resizes.

instance.clear()

Api to clear canvas.