heatmapfromdata
Advanced tools
Comparing version 1.2.1 to 1.2.2
'use strict'; | ||
// за что отвечает if | ||
if (typeof module !== 'undefined') module.exports.heatmapfromdata = heatmapfromdata; | ||
// module.exports.heatmapfromdata = heatmapfromdata; | ||
function heatmapfromdata(canvas) { | ||
// защита от НЕПРАВИЛЬНОЙ привязки контекста | ||
if (!(this instanceof heatmapfromdata)) return new heatmapfromdata(canvas); | ||
@@ -18,3 +17,3 @@ | ||
this._grad = [], | ||
this._sizeColors = 1000; // кол-ва цветов в градиенте | ||
this._sizeColors = 1000; | ||
} | ||
@@ -21,0 +20,0 @@ |
{ | ||
"name": "heatmapfromdata", | ||
"version": "1.2.1", | ||
"description": "This project draws mechanical processes", | ||
"version": "1.2.2", | ||
"description": "A JavaScript library for drawing heatmaps with Canvas.", | ||
"main": "heatmapfromdata.js", | ||
@@ -14,4 +14,3 @@ "scripts": { | ||
"keywords": [ | ||
"draw", | ||
"map" | ||
"heatmap" | ||
], | ||
@@ -18,0 +17,0 @@ "author": "svitbka", |
@@ -1,4 +0,39 @@ | ||
# Проект в который отрисовывает тепловыем процессы по данным | ||
heatmapfromdata | ||
=============== | ||
A JavaScript library for drawing heatmaps with Canvas. | ||
Demo: https://svitbka.github.io/heatmapfromdata/ | ||
```js | ||
heatmapfromdata('canvas').grad(gradient).data(data).draw(X, minValue); | ||
``` | ||
npm i heatmapfromdata | ||
``` | ||
## Reference | ||
#### Constructor | ||
```js | ||
var heat = simpleheat('canvas'); | ||
``` | ||
#### Data | ||
```js | ||
// set data of [[value1, value2, ... value10], ..., [value91, value92, ... value100]] format | ||
heat.data(data); | ||
``` | ||
#### Appearance | ||
```js | ||
// set data of [[r1, g1, b1], [r2, g2, b2], ...] format | ||
heat.gradient(grad); | ||
``` | ||
#### Rendering | ||
```js | ||
// draw a heat map using the required parameters, the variable X is calculated as follows: X = (The number of colors in the gradient) / (the sum of the modules of the maximum and minimum values in the data array), and the variable MinValue - the minimum values in the array data | ||
heat.draw(X, minValue); | ||
``` |
5257
40
94