Comparing version 0.1.1 to 0.2.0
{ | ||
"name": "simpleheat", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "A tiny JavaScript library for drawing heatmaps with Canvas", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/mourner/simpleheat", |
@@ -28,2 +28,5 @@ simpleheat | ||
// set max data value (1 by default) | ||
heat.max(max); | ||
// add a data point | ||
@@ -30,0 +33,0 @@ heat.add(point); |
@@ -19,2 +19,3 @@ /* | ||
this._max = 1; | ||
this.clear(); | ||
@@ -25,9 +26,12 @@ } | ||
data: function (data) { | ||
defaultRadius: 25, | ||
defaultGradient: {0.4: 'blue', 0.6: 'cyan', 0.7: 'lime', 0.8: 'yellow', 1: 'red'}, | ||
data: function (data, max) { | ||
this._data = data; | ||
return this; | ||
}, | ||
for (var i = 0, len = data.length; i < len; i++) { | ||
this._max = Math.max(this._max, data[i][2]); | ||
} | ||
max: function (max) { | ||
this._max = max; | ||
return this; | ||
@@ -38,3 +42,2 @@ }, | ||
this._data.push(point); | ||
this._max = Math.max(this._max, point[2]); | ||
return this; | ||
@@ -45,3 +48,3 @@ }, | ||
this._data = []; | ||
this._max = -Infinity; | ||
return this; | ||
}, | ||
@@ -92,6 +95,6 @@ | ||
if (!this._circle) { | ||
this.radius(25); | ||
this.radius(this.defaultRadius); | ||
} | ||
if (!this._grad) { | ||
this.gradient({0.45: 'blue', 0.55: 'cyan', 0.65: 'lime', 0.8: 'yellow', 1: 'red'}); | ||
this.gradient(this.defaultGradient); | ||
} | ||
@@ -98,0 +101,0 @@ |
Sorry, the diff of this file is not supported yet
18648
138
54