# simpleheat

> A tiny JavaScript library for drawing heatmaps with Canvas

Latest version **0.4.0** (published 2017-01-19) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install simpleheat
pnpm add simpleheat
yarn add simpleheat
bun add simpleheat
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2017-01-19 |
| First published | 2014-01-28 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | separate (@types/simpleheat) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 957 |
| Author | Vladimir Agafonkin |
| Maintainers | mourner |
| Keywords | heatmap, canvas, visualization |

## Links

- npm: https://www.npmjs.com/package/simpleheat
- Repository: https://github.com/mourner/simpleheat
- Issues: https://github.com/mourner/simpleheat/issues
- npm.io page: https://npm.io/package/simpleheat

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2017-01-19
- 0.3.0 — 2015-10-26
- 0.2.0 — 2014-01-31
- 0.1.1 — 2014-01-28
- 0.1.0 — 2014-01-28
- 0.0.1 — 2014-01-28

## README

simpleheat
==========

A super-tiny JavaScript library for drawing heatmaps with Canvas.
Inspired by [heatmap.js](https://github.com/pa7/heatmap.js), but with focus on simplicity and performance.

Powers [Leaflet.heat](https://github.com/Leaflet/Leaflet.heat), a heatmap plugin for [Leaflet](http://leafletjs.com).

Demo: http://mourner.github.io/simpleheat/demo

```js
simpleheat('canvas').data(data).draw();
```

## Reference

#### Constructor

```js
// create a simpleheat object given an id or canvas reference
var heat = simpleheat(canvas);
```

#### Data

```js
// set data of [[x, y, value], ...] format
heat.data(data);

// set max data value (1 by default)
heat.max(max);

// add a data point
heat.add(point);

// clear data
heat.clear();
```

#### Appearance

```js
// set point radius and blur radius (25 and 15 by default)
heat.radius(r, r2);

// set gradient colors as {<stop>: '<color>'}, e.g. {0.4: 'blue', 0.65: 'lime', 1: 'red'}
heat.gradient(grad);

// call in case Canvas size changed
heat.resize();
```

#### Rendering

```js
// draw the heatmap with optional minimum point opacity (0.05 by default)
heat.draw(minOpacity);
```

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