-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
22 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
/* | ||
* heatmap.js v2.0.2 | JavaScript Heatmap Library | ||
* heatmap.js v2.0.5 | JavaScript Heatmap Library | ||
* | ||
* Copyright 2008-2016 Patrick Wied <[email protected]> - All rights reserved. | ||
* Dual licensed under MIT and Beerware license | ||
* | ||
* :: 2016-02-04 21:25 | ||
* :: 2016-09-05 01:16 | ||
*/ | ||
;(function (name, context, factory) { | ||
|
||
|
@@ -38,7 +38,7 @@ var Store = (function StoreClosure() { | |
this._coordinator = {}; | ||
this._data = []; | ||
this._radi = []; | ||
this._min = 0; | ||
this._min = 10; | ||
this._max = 1; | ||
this._xField = config['xField'] || config.defaultXField; | ||
this._yField = config['yField'] || config.defaultYField; | ||
|
@@ -74,15 +74,23 @@ var Store = (function StoreClosure() { | |
} else { | ||
store[x][y] += value; | ||
} | ||
var storedVal = store[x][y]; | ||
|
||
if (store[x][y] > max) { | ||
if (storedVal > max) { | ||
if (!forceRender) { | ||
this._max = store[x][y]; | ||
this._max = storedVal; | ||
} else { | ||
this.setDataMax(store[x][y]); | ||
this.setDataMax(storedVal); | ||
} | ||
return false; | ||
} else{ | ||
} else if (storedVal < min) { | ||
if (!forceRender) { | ||
this._min = storedVal; | ||
} else { | ||
this.setDataMin(storedVal); | ||
} | ||
return false; | ||
} else { | ||
return { | ||
x: x, | ||
y: y, | ||
|
@@ -133,6 +141,10 @@ var Store = (function StoreClosure() { | |
// add to store | ||
var organisedEntry = this._organiseData(arguments[0], true); | ||
if (organisedEntry) { | ||
// if it's the first datapoint initialize the extremas with it | ||
if (this._data.length === 0) { | ||
this._min = this._max = organisedEntry.value; | ||
} | ||
this._coordinator.emit('renderpartial', { | ||
min: this._min, | ||
max: this._max, | ||
|
Oops, something went wrong.