no-heatmap.js 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/README.md +55 -0
- package/build/heatmap.js +729 -0
- package/build/heatmap.min.js +9 -0
- package/docs/assets/css/commons.css +41 -0
- package/docs/assets/css/docs.css +136 -0
- package/docs/assets/css/prism.css +126 -0
- package/docs/assets/js/prism.js +7 -0
- package/docs/faq.html +0 -0
- package/docs/getting-started.html +0 -0
- package/docs/how-to-migrate.md +97 -0
- package/docs/index.html +276 -0
- package/examples/angular-heatmap/index.html +64 -0
- package/examples/googlemaps-heatmap/index.html +65 -0
- package/examples/heatmap-legend/index.html +126 -0
- package/examples/leaflet-heatmap/index.html +80 -0
- package/examples/mousemove-heatmap/index.html +64 -0
- package/examples/raindrops/index.html +66 -0
- package/examples/svg-area-heatmap/austria.svg +1540 -0
- package/examples/svg-area-heatmap/index.html +62 -0
- package/examples/unblurred-datapoints/index.html +87 -0
- package/package.json +46 -0
- package/plugins/angular-heatmap/angular-heatmap.js +62 -0
- package/plugins/boilerplate.js +45 -0
- package/plugins/gmaps-heatmap/README.md +7 -0
- package/plugins/gmaps-heatmap/gmaps-heatmap.js +278 -0
- package/plugins/gmaps-heatmap/package.json +23 -0
- package/plugins/leaflet-heatmap/README.md +4 -0
- package/plugins/leaflet-heatmap/leaflet-heatmap.js +246 -0
- package/plugins/leaflet-heatmap/package.json +21 -0
- package/plugins/segment-heatmap.js +71 -0
- package/plugins/svg-area-heatmap.js +195 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* no-heatmap.js v2.0.8 | JavaScript Heatmap Library
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2008-2016 Patrick Wied <heatmapjs@patrick-wied.at> - All rights reserved.
|
|
5
|
+
* Dual licensed under MIT and Beerware license
|
|
6
|
+
*
|
|
7
|
+
* :: 2026-01-18 14:13
|
|
8
|
+
*/
|
|
9
|
+
(function(t,a,e){if(typeof module!=="undefined"&&module.exports){module.exports=e()}else if(typeof define==="function"&&define.amd){define(e)}else{a[t]=e()}})("h337",this,function(){var n={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",defaultDataStack:true,plugins:{}};var s=function t(){var a=function t(a){this._coordinator={};this._data=[];this._radi=[];this._min=10;this._max=1;this._xField=a["xField"]||a.defaultXField;this._yField=a["yField"]||a.defaultYField;this._valueField=a["valueField"]||a.defaultValueField;this._dataStack=a["dataStack"]===undefined?a.defaultDataStack:a["dataStack"];if(a["radius"]){this._cfgRadius=a["radius"]}};var _=n.defaultRadius;a.prototype={_organiseData:function(t,a){var e=t[this._xField];var i=t[this._yField];var r=this._radi;var n=this._data;var s=this._max;var h=this._min;var o=t[this._valueField]||1;var d=t.radius||this._cfgRadius||_;var l=this._dataStack;if(!n[e]){n[e]=[];r[e]=[]}if(!n[e][i]){n[e][i]=o;r[e][i]=d}else{if(l){n[e][i]+=o}else{n[e][i]=Math.max(o,n[e][i])}}var u=n[e][i];if(u>s){if(!a){this._max=u}else{this.setDataMax(u)}return false}else if(u<h){if(!a){this._min=u}else{this.setDataMin(u)}return false}else{return{x:e,y:i,value:o,radius:d,min:h,max:s}}},_unOrganizeData:function(){var t=[];var a=this._data;var e=this._radi;for(var i in a){for(var r in a[i]){t.push({x:i,y:r,radius:e[i][r],value:a[i][r]})}}return{min:this._min,max:this._max,data:t}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0){var t=arguments[0];var a=t.length;while(a--){this.addData.call(this,t[a])}}else{var e=this._organiseData(arguments[0],true);if(e){if(this._data.length===0){this._min=this._max=e.value}this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[e]})}}return this},setData:function(t){var a=t.data;var e=a.length;this._data=[];this._radi=[];for(var i=0;i<e;i++){this._organiseData(a[i],false)}this._max=t.max;this._min=t.min||0;this._onExtremaChange();this._coordinator.emit("renderall",this._getInternalData());return this},removeData:function(){},setDataMax:function(t){this._max=t;this._onExtremaChange();this._coordinator.emit("renderall",this._getInternalData());return this},setDataMin:function(t){this._min=t;this._onExtremaChange();this._coordinator.emit("renderall",this._getInternalData());return this},setCoordinator:function(t){this._coordinator=t},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}};return a}();var e=function t(){var s=function(t){var a=t.gradient||t.defaultGradient;var e=document.createElement("canvas");var i=e.getContext("2d");e.width=256;e.height=1;var r=i.createLinearGradient(0,0,256,1);for(var n in a){r.addColorStop(n,a[n])}i.fillStyle=r;i.fillRect(0,0,256,1);return i.getImageData(0,0,256,1).data};var v=function(t,a){var e=document.createElement("canvas");var i=e.getContext("2d");var r=t;var n=t;e.width=e.height=t*2;if(a==1){i.beginPath();i.arc(r,n,t,0,2*Math.PI,false);i.fillStyle="rgba(0,0,0,1)";i.fill()}else{var s=i.createRadialGradient(r,n,t*a,r,n,t);s.addColorStop(0,"rgba(0,0,0,1)");s.addColorStop(1,"rgba(0,0,0,0)");i.fillStyle=s;i.fillRect(0,0,2*t,2*t)}return e};var a=function(t){var a=[];var e=t.min;var i=t.max;var r=t.radi;var t=t.data;var n=Object.keys(t);var s=n.length;while(s--){var h=n[s];var o=Object.keys(t[h]);var d=o.length;while(d--){var l=o[d];var u=t[h][l];var _=r[h][l];a.push({x:h,y:l,value:u,radius:_})}}return{min:e,max:i,data:a}};function e(t){var a=t.container;var e=this.shadowCanvas=document.createElement("canvas");var i=this.canvas=t.canvas||document.createElement("canvas");var r=this._renderBoundaries=[1e4,1e4,0,0];var n=getComputedStyle(t.container)||{};i.className="heatmap-canvas";this._width=i.width=e.width=t.width||+n.width.replace(/px/,"");this._height=i.height=e.height=t.height||+n.height.replace(/px/,"");this.shadowCtx=e.getContext("2d");this.ctx=i.getContext("2d");i.style.cssText=e.style.cssText="position:absolute;left:0;top:0;";a.style.position="relative";a.appendChild(i);this._palette=s(t);this._templates={};this._setStyles(t)}e.prototype={renderPartial:function(t){if(t.data.length>0){this._drawAlpha(t);this._colorize()}},renderAll:function(t){this._clear();if(t.data.length>0){this._drawAlpha(a(t));this._colorize()}},_updateGradient:function(t){this._palette=s(t)},updateConfig:function(t){if(t["gradient"]){this._updateGradient(t)}this._setStyles(t)},setDimensions:function(t,a){this._width=t;this._height=a;this.canvas.width=this.shadowCanvas.width=t;this.canvas.height=this.shadowCanvas.height=a},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height);this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(t){this._blur=t.blur==0?0:t.blur||t.defaultBlur;if(t.backgroundColor){this.canvas.style.backgroundColor=t.backgroundColor}this._width=this.canvas.width=this.shadowCanvas.width=t.width||this._width;this._height=this.canvas.height=this.shadowCanvas.height=t.height||this._height;this._opacity=(t.opacity||0)*255;this._maxOpacity=(t.maxOpacity||t.defaultMaxOpacity)*255;this._minOpacity=(t.minOpacity||t.defaultMinOpacity)*255;this._useGradientOpacity=!!t.useGradientOpacity},_drawAlpha:function(t){var a=this._min=t.min;var e=this._max=t.max;var t=t.data||[];var i=t.length;var r=1-this._blur;while(i--){var n=t[i];var s=n.x;var h=n.y;var o=n.radius;var d=Math.min(n.value,e);var l=s-o;var u=h-o;var _=this.shadowCtx;var c;if(!this._templates[o]){this._templates[o]=c=v(o,r)}else{c=this._templates[o]}var f=(d-a)/(e-a);_.globalAlpha=f<.01?.01:f;_.drawImage(c,l,u);if(l<this._renderBoundaries[0]){this._renderBoundaries[0]=l}if(u<this._renderBoundaries[1]){this._renderBoundaries[1]=u}if(l+2*o>this._renderBoundaries[2]){this._renderBoundaries[2]=l+2*o}if(u+2*o>this._renderBoundaries[3]){this._renderBoundaries[3]=u+2*o}}},_colorize:function(){var t=this._renderBoundaries[0];var a=this._renderBoundaries[1];var e=this._renderBoundaries[2]-t;var i=this._renderBoundaries[3]-a;var r=this._width;var n=this._height;var s=this._opacity;var h=this._maxOpacity;var o=this._minOpacity;var d=this._useGradientOpacity;if(t<0){t=0}if(a<0){a=0}if(t+e>r){e=r-t}if(a+i>n){i=n-a}var l=this.shadowCtx.getImageData(t,a,e,i);var u=l.data;var _=u.length;var c=this._palette;for(var f=3;f<_;f+=4){var v=u[f];var g=v*4;if(!g){continue}var m;if(s>0){m=s}else{if(v<h){if(v<o){m=o}else{m=v}}else{m=h}}u[f-3]=c[g];u[f-2]=c[g+1];u[f-1]=c[g+2];u[f]=d?c[g+3]:m}this.ctx.putImageData(l,t,a);this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(t){var a;var e=this.shadowCtx;var i=e.getImageData(t.x,t.y,1,1);var r=i.data[3];var n=this._max;var s=this._min;a=Math.abs(n-s)*(r/255)>>0;return a},getDataURL:function(){return this.canvas.toDataURL()}};return e}();var h=function t(){var a=false;if(n["defaultRenderer"]==="canvas2d"){a=e}return a}();var o={merge:function(){var t={};var a=arguments.length;for(var e=0;e<a;e++){var i=arguments[e];for(var r in i){t[r]=i[r]}}return t}};var a=function t(){var i=function t(){function a(){this.cStore={}}a.prototype={on:function(t,a,e){var i=this.cStore;if(!i[t]){i[t]=[]}i[t].push(function(t){return a.call(e,t)})},emit:function(t,a){var e=this.cStore;if(e[t]){var i=e[t].length;for(var r=0;r<i;r++){var n=e[t][r];n(a)}}}};return a}();var r=function(a){var t=a._renderer;var e=a._coordinator;var i=a._store;e.on("renderpartial",t.renderPartial,t);e.on("renderall",t.renderAll,t);e.on("extremachange",function(t){a._config.onExtremaChange&&a._config.onExtremaChange({min:t.min,max:t.max,gradient:a._config["gradient"]||a._config["defaultGradient"]})});i.setCoordinator(e)};function a(){var t=this._config=o.merge(n,arguments[0]||{});this._coordinator=new i;if(t["plugin"]){var a=t["plugin"];if(!n.plugins[a]){throw new Error("Plugin '"+a+"' not found. Maybe it was not registered.")}else{var e=n.plugins[a];this._renderer=new e.renderer(t);this._store=new e.store(t)}}else{this._renderer=new h(t);this._store=new s(t)}r(this)}a.prototype={addData:function(){this._store.addData.apply(this._store,arguments);return this},removeData:function(){this._store.removeData&&this._store.removeData.apply(this._store,arguments);return this},setData:function(){this._store.setData.apply(this._store,arguments);return this},setDataMax:function(){this._store.setDataMax.apply(this._store,arguments);return this},setDataMin:function(){this._store.setDataMin.apply(this._store,arguments);return this},configure:function(t){this._config=o.merge(this._config,t);this._renderer.updateConfig(this._config);this._coordinator.emit("renderall",this._store._getInternalData());return this},repaint:function(){this._coordinator.emit("renderall",this._store._getInternalData());return this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(t){if(this._store.getValueAt){return this._store.getValueAt(t)}else if(this._renderer.getValueAt){return this._renderer.getValueAt(t)}else{return null}}};return a}();var t={create:function(t){return new a(t)},register:function(t,a){n.plugins[t]=a}};return t});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
html, body, p, div { margin:0; padding:0; }
|
|
2
|
+
.wrapper { width:840px; position:relative; margin:auto; }
|
|
3
|
+
|
|
4
|
+
.breadcrumb-trail {
|
|
5
|
+
list-style:none;
|
|
6
|
+
list-style-type:none;
|
|
7
|
+
display:block;
|
|
8
|
+
font-size:10pt;
|
|
9
|
+
margin-top:0;
|
|
10
|
+
margin-bottom:0;
|
|
11
|
+
padding-left:0;
|
|
12
|
+
}
|
|
13
|
+
.breadcrumb-trail li {
|
|
14
|
+
display:inline-block;
|
|
15
|
+
padding:5px;
|
|
16
|
+
margin-right:15px;
|
|
17
|
+
position:relative;
|
|
18
|
+
line-height:normal;
|
|
19
|
+
}
|
|
20
|
+
.breadcrumb-trail a {
|
|
21
|
+
text-decoration:none;
|
|
22
|
+
color:blue;
|
|
23
|
+
font-weight:400;
|
|
24
|
+
padding-bottom:1px;
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
.breadcrumb-trail a:hover {
|
|
28
|
+
border-bottom:1px solid blue;
|
|
29
|
+
}
|
|
30
|
+
.breadcrumb-trail li:before{
|
|
31
|
+
content:'\0BB';
|
|
32
|
+
position:absolute;
|
|
33
|
+
left:-14px;
|
|
34
|
+
top:0px;
|
|
35
|
+
font-weight:normal;
|
|
36
|
+
font-size:14pt;
|
|
37
|
+
}
|
|
38
|
+
.breadcrumb-trail li:first-child:before {
|
|
39
|
+
content:'';
|
|
40
|
+
margin-left:0;
|
|
41
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
html {
|
|
2
|
+
color: #333;
|
|
3
|
+
font-family: sans-serif;
|
|
4
|
+
font-size: 16pt;
|
|
5
|
+
font-weight: 100;
|
|
6
|
+
line-height: 1.4em;
|
|
7
|
+
}
|
|
8
|
+
html, body, p, div { margin:0; padding:0; }
|
|
9
|
+
.hot-doc {
|
|
10
|
+
background:#f65656;
|
|
11
|
+
}
|
|
12
|
+
.avg-doc {
|
|
13
|
+
background:#54cb44;
|
|
14
|
+
}
|
|
15
|
+
.cold-doc {
|
|
16
|
+
background:#4C94FF;
|
|
17
|
+
}
|
|
18
|
+
.wrapper {
|
|
19
|
+
width:auto;
|
|
20
|
+
position:relative;
|
|
21
|
+
max-width:900px;
|
|
22
|
+
margin:auto;
|
|
23
|
+
padding-top:25px;
|
|
24
|
+
}
|
|
25
|
+
.description {
|
|
26
|
+
padding:10px;
|
|
27
|
+
line-height: 28px;
|
|
28
|
+
}
|
|
29
|
+
strong.highlight {
|
|
30
|
+
padding: 4px;
|
|
31
|
+
font-weight: normal;
|
|
32
|
+
color:white;
|
|
33
|
+
}
|
|
34
|
+
.functions .description {
|
|
35
|
+
background:white;
|
|
36
|
+
margin-bottom: 5px;
|
|
37
|
+
}
|
|
38
|
+
.fn { box-shadow:0 1px 1px rgba(0,0,0,.23); }
|
|
39
|
+
.fn h3 {
|
|
40
|
+
padding:10px;
|
|
41
|
+
font-size:22px;
|
|
42
|
+
letter-spacing:1px;
|
|
43
|
+
font-weight:bold;
|
|
44
|
+
background:rgba(0, 0, 0, 0.11);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
h2 { padding-left:10px; }
|
|
48
|
+
h1 { text-align:center; margin-top:30px;}
|
|
49
|
+
ul {
|
|
50
|
+
list-style: none;
|
|
51
|
+
margin:0;
|
|
52
|
+
padding:0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
li {
|
|
56
|
+
padding-left: 1em;
|
|
57
|
+
|
|
58
|
+
text-indent: -1em;
|
|
59
|
+
}
|
|
60
|
+
#index li {
|
|
61
|
+
border-bottom:1px solid rgba(0,0,0,.3);
|
|
62
|
+
padding-top:8px;
|
|
63
|
+
padding-bottom:8px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#index li:before {
|
|
67
|
+
content: "+";
|
|
68
|
+
padding-left:5px;
|
|
69
|
+
padding-right: 5px;
|
|
70
|
+
}
|
|
71
|
+
li:before {
|
|
72
|
+
content: "-";
|
|
73
|
+
padding-left:5px;
|
|
74
|
+
padding-right: 5px;
|
|
75
|
+
}
|
|
76
|
+
li a { color:white; letter-spacing:1px;}
|
|
77
|
+
#index h2 { font-size:26px; padding-left:15px; padding-top:5px; margin-bottom:8px; }
|
|
78
|
+
#index div {
|
|
79
|
+
color: black;
|
|
80
|
+
display:inline-table;
|
|
81
|
+
box-shadow: 0 0 1px black;
|
|
82
|
+
width:45%;
|
|
83
|
+
margin-right:1%;
|
|
84
|
+
|
|
85
|
+
overflow:hidden;
|
|
86
|
+
}
|
|
87
|
+
#index-heatmapInstance { width:51% !important;}
|
|
88
|
+
#index { width:65%; margin:auto; margin-top:30px; margin-bottom:50px; }
|
|
89
|
+
section { margin-bottom:60px; }
|
|
90
|
+
#message {
|
|
91
|
+
overflow:hidden;
|
|
92
|
+
width: 75%;
|
|
93
|
+
margin: auto;
|
|
94
|
+
margin-top: 30px;
|
|
95
|
+
background: rgba(0,0,0,.06);
|
|
96
|
+
box-shadow: 0 0 2px black;
|
|
97
|
+
padding-left:20px;
|
|
98
|
+
padding-right:20px;
|
|
99
|
+
margin-bottom:50px;
|
|
100
|
+
}
|
|
101
|
+
#message h3 { padding-left:0; font-weight:normal; cursor:pointer;}
|
|
102
|
+
#msg-content {
|
|
103
|
+
height:230px; padding-top:0; padding-bottom:0; opacity:1;
|
|
104
|
+
}
|
|
105
|
+
#msg-content.animate {
|
|
106
|
+
-webkit-transition:.7s ease all;
|
|
107
|
+
-moz-transition:.7s ease all;
|
|
108
|
+
transition:.7s ease all;
|
|
109
|
+
}
|
|
110
|
+
#msg-content.hide{ height:0; padding-left:20px; padding-right:20px; opacity:0; }
|
|
111
|
+
.msg { padding:10px;background:white; line-height:32px;}
|
|
112
|
+
#btn-confirm {
|
|
113
|
+
padding: 10px;
|
|
114
|
+
text-align: center;
|
|
115
|
+
background: #54cb44;
|
|
116
|
+
margin: auto;
|
|
117
|
+
color: white;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
-webkit-transition: 0.7s all ease;
|
|
120
|
+
-moz-transition:.7 all ease;
|
|
121
|
+
transition: 0.7s all ease;
|
|
122
|
+
border:none;
|
|
123
|
+
font-size:20px;
|
|
124
|
+
width: 150px;
|
|
125
|
+
margin-top: 15px;
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
#btn-confirm:hover {
|
|
129
|
+
background: #f65656;
|
|
130
|
+
}
|
|
131
|
+
.description ul li { margin-bottom:15px; margin-top:10px; }
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@media(max-width:800px) {
|
|
135
|
+
#message { display:none; }
|
|
136
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */
|
|
2
|
+
/**
|
|
3
|
+
* prism.js default theme for JavaScript, CSS and HTML
|
|
4
|
+
* Based on dabblet (http://dabblet.com)
|
|
5
|
+
* @author Lea Verou
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
code[class*="language-"],
|
|
9
|
+
pre[class*="language-"] {
|
|
10
|
+
color: black;
|
|
11
|
+
text-shadow: 0 1px white;
|
|
12
|
+
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
|
13
|
+
direction: ltr;
|
|
14
|
+
text-align: left;
|
|
15
|
+
white-space: pre;
|
|
16
|
+
word-spacing: normal;
|
|
17
|
+
word-break: normal;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
-moz-tab-size: 4;
|
|
21
|
+
-o-tab-size: 4;
|
|
22
|
+
tab-size: 4;
|
|
23
|
+
|
|
24
|
+
-webkit-hyphens: none;
|
|
25
|
+
-moz-hyphens: none;
|
|
26
|
+
-ms-hyphens: none;
|
|
27
|
+
hyphens: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
|
|
31
|
+
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
|
|
32
|
+
text-shadow: none;
|
|
33
|
+
background: #b3d4fc;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
|
|
37
|
+
code[class*="language-"]::selection, code[class*="language-"] ::selection {
|
|
38
|
+
text-shadow: none;
|
|
39
|
+
background: #b3d4fc;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@media print {
|
|
43
|
+
code[class*="language-"],
|
|
44
|
+
pre[class*="language-"] {
|
|
45
|
+
text-shadow: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Code blocks */
|
|
50
|
+
pre[class*="language-"] {
|
|
51
|
+
padding: 1em;
|
|
52
|
+
margin: .5em 0;
|
|
53
|
+
overflow: auto;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:not(pre) > code[class*="language-"],
|
|
57
|
+
pre[class*="language-"] {
|
|
58
|
+
background: #f5f2f0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Inline code */
|
|
62
|
+
:not(pre) > code[class*="language-"] {
|
|
63
|
+
padding: .1em;
|
|
64
|
+
border-radius: .3em;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.token.comment,
|
|
68
|
+
.token.prolog,
|
|
69
|
+
.token.doctype,
|
|
70
|
+
.token.cdata {
|
|
71
|
+
color: slategray;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.token.punctuation {
|
|
75
|
+
color: #999;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.namespace {
|
|
79
|
+
opacity: .7;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.token.property,
|
|
83
|
+
.token.tag,
|
|
84
|
+
.token.boolean,
|
|
85
|
+
.token.number,
|
|
86
|
+
.token.constant,
|
|
87
|
+
.token.symbol {
|
|
88
|
+
color: #905;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.token.selector,
|
|
92
|
+
.token.attr-name,
|
|
93
|
+
.token.string,
|
|
94
|
+
.token.builtin {
|
|
95
|
+
color: #690;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.token.operator,
|
|
99
|
+
.token.entity,
|
|
100
|
+
.token.url,
|
|
101
|
+
.language-css .token.string,
|
|
102
|
+
.style .token.string,
|
|
103
|
+
.token.variable {
|
|
104
|
+
color: #a67f59;
|
|
105
|
+
background: hsla(0,0%,100%,.5);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.token.atrule,
|
|
109
|
+
.token.attr-value,
|
|
110
|
+
.token.keyword {
|
|
111
|
+
color: #07a;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
.token.regex,
|
|
116
|
+
.token.important {
|
|
117
|
+
color: #e90;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.token.important {
|
|
121
|
+
font-weight: bold;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.token.entity {
|
|
125
|
+
cursor: help;
|
|
126
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */
|
|
2
|
+
var self=typeof window!="undefined"?window:{},Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content)):t.util.type(e)==="Array"?e.map(t.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;var l={element:r,language:o,grammar:u,code:f};t.hooks.run("before-highlight",l);if(i&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){l.highlightedCode=n.stringify(JSON.parse(e.data),o);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(l.element);t.hooks.run("after-highlight",l)};c.postMessage(JSON.stringify({language:l.language,code:l.code}))}else{l.highlightedCode=t.highlight(l.code,l.grammar,l.language);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(r);t.hooks.run("after-highlight",l)}},highlight:function(e,r,i){var s=t.tokenize(e,r);return n.stringify(t.util.encode(s),i)},tokenize:function(e,n,r){var i=t.Token,s=[e],o=n.rest;if(o){for(var u in o)n[u]=o[u];delete n.rest}e:for(var u in n){if(!n.hasOwnProperty(u)||!n[u])continue;var a=n[u],f=a.inside,l=!!a.lookbehind,c=0;a=a.pattern||a;for(var h=0;h<s.length;h++){var p=s[h];if(s.length>e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+"</"+s.tag+">"};if(!self.document){if(!self.addEventListener)return self.Prism;self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return self.Prism}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}return self.Prism}();typeof module!="undefined"&&module.exports&&(module.exports=Prism);;
|
|
3
|
+
Prism.languages.markup={comment:/<!--[\w\W]*?-->/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/\&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});;
|
|
4
|
+
Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,"function":/[-a-z0-9]+(?=\()/ig};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/<style[\w\W]*?>[\w\W]*?<\/style>/ig,inside:{tag:{pattern:/<style[\w\W]*?>|<\/style>/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});;
|
|
5
|
+
Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};;
|
|
6
|
+
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/<script[\w\W]*?>[\w\W]*?<\/script>/ig,inside:{tag:{pattern:/<script[\w\W]*?>|<\/script>/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});
|
|
7
|
+
;
|
package/docs/faq.html
ADDED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# How to migrate from heatmap.js v1.0 to v2.0
|
|
2
|
+
|
|
3
|
+
This document will describe the major public API changes and how you have to adapt your code to make your project work with heatmap.js v2.0
|
|
4
|
+
|
|
5
|
+
## element -> container
|
|
6
|
+
I thought this would describe the config property better, now the element property should be called container property:
|
|
7
|
+
|
|
8
|
+
```javascript
|
|
9
|
+
|
|
10
|
+
var cfg = {
|
|
11
|
+
"container": domElement
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## opacity -> maxOpacity
|
|
18
|
+
With the new heatmap.js v2.0 the opacity config property is affecting the global opacity (it sets the opacity for all datapoints and prevents smooth gradients). If you want to achieve smooth datapoint gradients you now have to use the maxOpacity config property:
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
|
|
22
|
+
var cfg = {
|
|
23
|
+
"maxOpacity": .8
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Also, opacity, maxOpacity, and minOpacity should now be a decimal number within [0,1].
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Feeding heatmap.js with data
|
|
31
|
+
|
|
32
|
+
I decided to reduce the API to a more flat structure. That means you don't have to access the datastore of a heatmap to add the data but rather can add the new data directly at your heatmap instance. I also got rid of naming redundance ( `heatmap.store.addDataPoint` -> `heatmap.addData`, `heatmap.store.setDataSet` -> `heatmap.setData`).
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
var datapoint = { x: 100, y: 100, value: 10 };
|
|
36
|
+
|
|
37
|
+
heatmap.addData(datapoint);
|
|
38
|
+
|
|
39
|
+
heatmap.setData({
|
|
40
|
+
max: 10,
|
|
41
|
+
data: [datapoint]
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Also, as you probably have noticed: the count property of a datapoint is now called value by default BUT for migration sake you can tell heatmap.js to use "count" as a valueField:
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
var datapoint = { x: 100, y: 100, count: 10 };
|
|
50
|
+
|
|
51
|
+
var heatmap = h337.create({
|
|
52
|
+
container: domElement,
|
|
53
|
+
// ...
|
|
54
|
+
valueField: 'count'
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
heatmap.addData(datapoint);
|
|
58
|
+
|
|
59
|
+
heatmap.setData({
|
|
60
|
+
max: 10,
|
|
61
|
+
data: [datapoint]
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
# Summary
|
|
68
|
+
|
|
69
|
+
Old configuration example:
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
|
|
73
|
+
var cfg = {
|
|
74
|
+
"element": domElement,
|
|
75
|
+
"opacity": 80
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
var heatmap = h337.create(cfg);
|
|
79
|
+
|
|
80
|
+
heatmap.store.setDataSet(data);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
turns into new configuration:
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
|
|
87
|
+
var cfg = {
|
|
88
|
+
"container": domElement,
|
|
89
|
+
"maxOpacity": .8
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
var heatmap = h337.create(cfg);
|
|
93
|
+
|
|
94
|
+
heatmap.setData(data);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Have a look at the documentation (it's inside the repo at /docs/) to see the full API
|