HBuilder +js 实现网页热力图
废话不多说,上代码
111A Quick ExampleWith only a few lines of code you can create your own interactive web heatmap:heatmap ); geoFindMe() { ); navigator.geolocation){ ; 31 return; 32 } success(position) { position.coords.latitude; position.coords.longitude; ; Image(); ; 42 43 output.appendChild(img); 44 }; error() { ; 48 }; ; 51 52 navigator.geolocation.getCurrentPosition(success, error); 53 } () { 61 62 geoFindMe(); ); h337.create({ 66 container: ex1el 67 }); () { {}; []; ; ; ; ; ) { ; Math.max(max1, val); { w), h), 82 value: val 83 }; 84 datap1.push(d); 85 } max1; datap1; 88 89 heatmap3.setData(data1); 90 }; 91 refreshHeatmap1(); () { 94 refreshHeatmap1(); 95 }; 96 };
代码中用到的 heatmap.min.js 请搜索 heatmap 下载
/*
* heatmap.js v2.0.0 | JavaScript Heatmap Library
*
* Copyright 2008-2014 Patrick Wied <heatmapjs@patrick-wied.at> - All rights reserved.
* Dual licensed under MIT and Beerware license
*
* :: 2014-08-05 01:42
*/