{"id":213,"date":"2014-09-11T23:51:21","date_gmt":"2014-09-11T15:51:21","guid":{"rendered":"http:\/\/www.hightopo.com\/blog\/?p=213"},"modified":"2014-09-12T00:02:14","modified_gmt":"2014-09-11T16:02:14","slug":"%e5%9f%ba%e4%ba%8ehtml5%e5%ae%9e%e7%8e%b0%e7%9a%84heatmap%e7%83%ad%e5%9b%be3d%e5%ba%94%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.hightopo.com\/blog\/213.html","title":{"rendered":"\u57fa\u4e8eHTML5\u5b9e\u73b0\u7684Heatmap\u70ed\u56fe3D\u5e94\u7528"},"content":{"rendered":"<p>Heatmap\u70ed\u56fe\u901a\u8fc7\u4f17\u591a\u6570\u636e\u70b9\u4fe1\u606f\uff0c\u6c47\u805a\u6210\u76f4\u89c2\u53ef\u89c6\u5316\u989c\u8272\u6548\u679c\uff0c\u70ed\u56fe\u5df2\u5e7f\u6cdb\u88ab\u5e94\u7528\u4e8e\u6c14\u8c61\u9884\u62a5\u3001\u533b\u7597\u6210\u50cf\u3001\u673a\u623f\u6e29\u5ea6\u76d1\u63a7\u7b49\u884c\u4e1a\uff0c\u751a\u81f3\u5e94\u7528\u4e8e\u7ade\u6280\u4f53\u80b2\u9886\u57df\u7684\u6570\u636e\u5206\u6790\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/Viz-Libero-heat-map1.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-217\" alt=\"Viz Libero heat map\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/Viz-Libero-heat-map1.png\" width=\"700\" height=\"387\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/Viz-Libero-heat-map1.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/Viz-Libero-heat-map1-300x165.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/Viz-Libero-heat-map1-200x110.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>\u5df2\u6709\u4f17\u591a\u6587\u7ae0\u5206\u4eab\u4e86\u751f\u6210Heatmap\u70ed\u56fe\u539f\u7406\uff0c\u53ef\u53c2\u8003\u300a<a href=\"http:\/\/blog.corunet.com\/how-to-make-heat-maps\/\">How to make heat maps<\/a>\u300b\u548c\u300a<a href=\"http:\/\/michaelvandaniker.com\/blog\/2008\/07\/06\/how-to-make-heat-maps-in-flex\/\">How to make heat maps in Flex<\/a>\u300b\uff0c\u672c\u6587\u5c06\u4ecb\u7ecd\u57fa\u4e8eHTML5\u6280\u672f\u7684\u5b9e\u73b0\u65b9\u5f0f\uff0c\u4e3b\u8981\u57fa\u4e8eCavans\u548cWebGL\u8fd9\u4e24\u79cdHTML5\u76842D\u548c3D\u6280\u672f\u7684\u5e94\u7528\uff0c\u5148\u4e0a\u6700\u7ec8\u4f8b\u5b50\u5b9e\u73b0\u7684\u754c\u9762\u6548\u679c\u548c<a href=\"http:\/\/v.youku.com\/v_show\/id_XNzc5ODYxNjY4.html?firsttime=0\">\u64cd\u4f5c\u89c6\u9891<\/a>\uff1a<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/IMG_10361.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-216\" alt=\"IMG_1036\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/IMG_10361.jpg\" width=\"700\" height=\"525\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/IMG_10361.jpg 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/IMG_10361-300x225.jpg 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/IMG_10361-200x150.jpg 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p><iframe loading=\"lazy\" src=\"http:\/\/player.youku.com\/embed\/XNzc5ODYxNjY4\" height=\"498\" width=\"510\" allowfullscreen=\"\" frameborder=\"0\"><\/iframe><br \/>\n\u5b9e\u73b0Heatmap\u7684\u5f00\u6e90js\u5e93\u6bd4\u8f83\u51fa\u540d\u7684\u5c31\u662f\u00a0<a href=\"http:\/\/www.patrick-wied.at\/static\/heatmapjs\/\">heatmapjs<\/a>\u00a0\uff0c\u8be5\u6846\u67b6\u53d1\u5c55\u4e862\u5e74\u591a\uff0c\u4f5c\u8005Patrick Wied\u6700\u8fd1\u51b3\u5b9a\u5728\u4fdd\u6301\u5f00\u6e90\u7684\u57fa\u7840\u4e0a\uff0c\u63d0\u4f9b\u6709\u507f\u7684\u5546\u4e1a\u652f\u6301\u670d\u52a1\uff0c\u8fd9\u662f\u597d\u4e8b\uff0c\u5730\u7403\u4e0a\u7edd\u5927\u90e8\u5206\u5f00\u6e90\u9879\u76ee\u4f5c\u8005\u641e\u4e2abarely\u53ef\u7528\u7684\u521d\u7ea7\u7248\u672c\u540e\uff0c\u5c31\u591a\u5e74\u4e0d\u89c1\u66f4\u65b0\u4e86\uff0c\u800c\u771f\u6b63\u80fd\u5b9e\u9645\u4e0a\u7ebf\u4f7f\u7528\u7684\u4ea7\u54c1\u54ea\u6709\u4e0d\u9700\u8981\u6301\u7eed\u5b8c\u5584\u3001\u589e\u5f3a\u53ef\u6269\u5c55\u6027\u4ee5\u53ca\u63d0\u4f9b\u7279\u6b8a\u5b9a\u5236\u670d\u52a1\u7684\uff0c\u8003\u8651\u5230\u4f5c\u8005\u8fd9\u4e24\u5e74\u5df2\u65e0\u507f\u6295\u4e86\u8fd9\u4e48\u591a\uff08<a href=\"http:\/\/www.patrick-wied.at\/static\/heatmapjs\/get-heatmap.html\">Over the last 2 years, I devoted\u00a0<strong>more than 500 hours<\/strong>\u00a0of work to improving heatmap.js to make it a truly great library.<\/a>\u00a0\uff09\uff0c\u5e0c\u671b\u6b64\u6587\u4e5f\u80fd\u5e2e\u4f5c\u8005\u5728\u56fd\u5185\u8d77\u70b9\u5ba3\u4f20\u4f5c\u7528\u3002<\/p>\n<p><a href=\"http:\/\/www.patrick-wied.at\/static\/heatmapjs\/\">heatmapjs<\/a>\u00a0\u91c7\u7528\u7684Canvas\u76842D\u7ed8\u5236\u65b9\u5f0f\u5b9e\u73b0\uff0c\u8fd9\u79cd\u57fa\u4e8eCPU\u7684\u7ed8\u5236\u65b9\u5f0f\u5bf9\u4e8e\u51e0\u767e\u51e0\u5343\u7684\u70b9\u8fd8\u51d1\u5408\uff0c\u4f46\u5982\u679c\u9700\u8981\u5b9e\u65f6\u8fd0\u7b97\u6210\u5343\u4e0a\u4e07\u8282\u70b9\u6548\u679c\u7684\uff0c\u8fd8\u662f\u5f97\u4f9d\u9760\u5e76\u53d1\u6027\u66f4\u5f3a\u5927\u7684GPU\u65b9\u5f0f\uff0c\u91c7\u7528HTML5\u7684\u8bdd\u53ea\u80fd\u662fWebGL\u65b9\u6848\uff0c\u8fd8\u597dFlorian Boesch\u5728\u300a<a href=\"http:\/\/codeflow.org\/entries\/2013\/feb\/04\/high-performance-js-heatmaps\">High Performance JS heatmaps<\/a>\u300b\u535a\u5ba2\u4e2d\u63d0\u4f9b\u4e86\u57fa\u4e8eWebGL\u5b9e\u73b0\u7684heatmap\u65b9\u5f0f\uff0c\u5e76\u5c06\u5176\u5f00\u6e90\u5728<a href=\"https:\/\/github.com\/pyalot\/webgl-heatmap\">https:\/\/github.com\/pyalot\/webgl-heatmap\u00a0<\/a>\u00a0\u4e0a\uff0c\u8fd9\u4e24\u4e2a\u5f00\u6e90\u5e93\u8d28\u91cf\u90fd\u8fd8\u4e0d\u9519\uff0c\u4e00\u4e2a\u57fa\u4e8eCanvas\u5b9e\u73b0\uff0c\u4e00\u4e2a\u57fa\u4e8eWebGL\u5b9e\u73b0\uff0c\u540e\u8005\u6027\u80fd\u9ad8\u70b9\uff0c\u4f46\u9700\u8981\u652f\u6301WebGL\u7684\u6d4f\u89c8\u5668\uff0c<a href=\"http:\/\/www.patrick-wied.at\/static\/heatmapjs\/\">heatmapjs<\/a>\u00a0\u7684\u6587\u6863\u4f8b\u5b50\u6bd4\u8f83\u5168\u9762\uff0c\u4f46\u4e24\u8005\u63a5\u53e3\u90fd\u975e\u5e38\u7b80\u5355\u6613\u5b66\uff0c\u4ee3\u7801\u4e5f\u90fd\u5c31\u51e0\u767e\u884c\uff0c\u4f60\u5b8c\u5168\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u60c5\u51b5\u9009\u62e9\u751a\u81f3\u8fdb\u884c\u4ee3\u7801\u6539\u9020\u4f18\u5316\u3002<\/p>\n<p>\u56de\u5230\u6211\u4eec\u8981\u5b9e\u73b0\u7684\u4f8b\u5b50\uff0c\u6211\u5c06\u91c7\u7528<a href=\"http:\/\/www.patrick-wied.at\/static\/heatmapjs\/\">heatmapjs<\/a>\u5728\u5185\u5b58\u4e2d\u5b9e\u65f6\u8fd0\u7b97\u51fa\u70ed\u56fe\uff0c\u7ed3\u5408<a href=\"http:\/\/www.hightopo.com\/\">hightopo<\/a>\u7684<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u76843D\u5f15\u64ce\uff0c\u4ee5\u4e00\u5806\u8282\u70b9\u8fde\u7ebf\u5173\u7cfb\u76843D\u7684\u7f51\u7edc\u62d3\u6251\u56fe\uff0c\u5176\u4e2d\u8282\u70b9\u4ee3\u8868\u70ed\u6e90\uff0c\u5176\u8d8a\u63a5\u8fd1\u5730\u9762\u5219\u5730\u9762\u6e29\u5ea6\u8d8a\u9ad8\uff0c\u8fd9\u6837\u6bcf\u4e2a\u8282\u70b9\u7684xz\u9762\u5750\u6807\u4fe1\u606f\u4f5c\u4e3a\u8981\u4f20\u5165\u7ed9heatmapjs\u7684\u70b9xy\u4e8c\u7ef4\u5750\u6807\u4fe1\u606f\uff0c\u4e09\u7ef4\u8282\u70b9\u7684elevation\u4e5f\u5c31\u662fy\u8f74\u4fe1\u606f\uff0c\u5219\u4f5c\u4e3a\u79bb\u5730\u9762\u7684\u8ddd\u79bb\u4fe1\u606f\uff0c\u8ddd\u79bb\u8d8a\u5927\u8f6c\u6210\u8981\u4f20\u5165heatmapjs\u7684value\u503c\u8d8a\u5c0f\uff0c\u6700\u540e\u542f\u52a8<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u7684\u4e09\u7ef4\u62d3\u6251\u81ea\u52a8\u5e03\u5c40\u5f39\u529b\u7b97\u6cd5\uff0c\u8fd9\u6837\u53ef\u76f4\u89c2\u7684\u89c2\u5bdf\u56fe\u5143\u8282\u70b9\u5728\u4e0d\u540c\u7684\u7a7a\u95f4\u4f4d\u7f6e\u52a8\u6001\u53d8\u5316\u65f6\u5730\u677f\u7684\u6e29\u5ea6\u70ed\u56fe\u53d8\u5316\u6548\u679c\u3002<\/p>\n<p>\u4ee3\u7801\u6838\u5fc3\u5c31\u5728\u91cd\u8f7dforceLayout.onRelaxed\u51fd\u6570\uff0c\u5728\u6bcf\u6b21\u81ea\u52a8\u5e03\u5c40\u8fc7\u7a0b\u5c06\u6240\u6709\u70ed\u6e90\u8282\u70b9\u7684\u4fe1\u606f\u6784\u5efa\u6210heatmap\u9700\u8981\u7684\u6570\u636e\uff0c\u540c\u65f6\u901a\u8fc7ht.Default.setImage(&#8216;hm-bottom&#8217;, heatmap._renderer.canvas);\u5c06\u70ed\u56fe\u7684canvas\u6ce8\u518c\u6210<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684\u56fe\u7247\uff0c\u800cfloor\u7684\u5730\u677f\u56fe\u5143\u7ed1\u5b9a\u4e86\u6ce8\u518c\u7684&#8217;hm-bottom&#8217;\u56fe\u7247\uff0c\u8fd9\u6837\u5c31\u5b9e\u73b0\u4e86\u5185\u5b58\u7ed8\u5236canvas\uff0c\u7136\u540e\u901a\u8fc7<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u76843D\u5f15\u64ce\u5c06Cavnas\u4f5c\u4e3a\u8d34\u56fe\u4fe1\u606f\u52a8\u6001\u5448\u73b0\u52303D\u573a\u666f\u7684\u6548\u679c\u3002<\/p>\n<p>\u6574\u4e2a\u5b9e\u73b0\u4ee3\u7801\u5982\u4e0b\u4e0d\u5230\u767e\u884c\uff0c\u4f60\u4e5f\u53ef\u4ee5\u91c7\u7528<a href=\"https:\/\/github.com\/pyalot\/webgl-heatmap\">https:\/\/github.com\/pyalot\/webgl-heatmap\u00a0<\/a>\u7684WebGL\u65b9\u5f0f\u6765\u5b9e\u73b0\uff0c\u8fd9\u6837\u5c31\u662f3D\u52302D\u518d\u52303D\u7684\u6709\u8da3\u8fc7\u7a0b\uff0c\u8fd9\u5c31\u662fHTML5\u6280\u672f\u53ef\u65e0\u7f1d\u878d\u5408\u5404\u79cd\u65b9\u6848\u7684\u9b45\u529b\uff01<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">        MAX = 500;\r\n        WIDTH = 1024;\r\n        HEIGHT = 512;        \r\n        function init() {                           \r\n            dataModel = new ht.DataModel();            \r\n            g3d = new ht.graph3d.Graph3dView(dataModel);                            \r\n            g3d.getMoveMode = function(e){ return 'xyz'; };                        \r\n            view = g3d.getView();            \r\n            view.className = 'main';\r\n            document.body.appendChild(view);    \r\n            window.addEventListener('resize', function (e) { g3d.invalidate(); }, false); \r\n            heatmap = h337.create({ width: WIDTH, height: HEIGHT });               \r\n            ht.Default.setImage('hm-bottom', heatmap._renderer.canvas);            \r\n            var floor = new ht.Node();\r\n            floor.s3(WIDTH, 1, HEIGHT);\r\n            floor.s({\r\n                '3d.selectable': false,\r\n                'layoutable': false,\r\n                'all.visible': false,\r\n                'top.visible': true,\r\n                'top.image': 'hm-bottom',\r\n                'top.reverse.flip': true,\r\n                'bottom.visible': true,\r\n                'bottom.transparent': true,\r\n                'bottom.opacity': 0.5,\r\n                'bottom.reverse.flip': true                \r\n            });\r\n            dataModel.add(floor);            \r\n            var root = createNode();                   \r\n            for (var i = 0; i &lt; 3; i++) {\r\n                var iNode = createNode();                       \r\n                createEdge(root, iNode);\r\n                for (var j = 0; j &lt; 3; j++) {                     var jNode = createNode();                                                 createEdge(iNode, jNode);                                                                          }             }                                forceLayout = new ht.layout.Force3dLayout(g3d);               forceLayout.setEdgeRepulsion(1);             forceLayout.start();             forceLayout.onRelaxed = function(){                 var points = [];                 dataModel.each(function(data){                     if(data instanceof ht.Node &amp;&amp; data !== floor){                         var p3 = data.p3();                         if(p3[1] &gt; MAX){\r\n                            p3[1] = MAX;\r\n                            data.setElevation(MAX);\r\n                        }\r\n                        else if(p3[1] &lt; -MAX){\r\n                            p3[1] = -MAX;\r\n                            data.setElevation(-MAX);\r\n                        }                        \r\n                        points.push({\r\n                            x: p3[0] + WIDTH\/2,\r\n                            y: p3[2] + HEIGHT\/2,\r\n                            value: MAX - Math.abs(p3[1])\r\n                        });\r\n                    }\r\n                });\r\n                heatmap.setData({data: points, min: 0, max: MAX});\r\n            };\r\n        }\r\n        function createNode(){\r\n            var node = new ht.Node();             \r\n            node.s({\r\n                'shape3d': 'sphere',\r\n                'shape3d.color': '#E74C3C',\r\n                'shape3d.opacity': 0.8,\r\n                'shape3d.transparent': true,\r\n                'shape3d.reverse.cull': true\r\n            });\r\n            node.s3(20, 20, 20);\r\n            dataModel.add(node);\r\n            return node;\r\n        }\r\n        function createEdge(sourceNode, targetNode){\r\n            var edge = new ht.Edge(sourceNode, targetNode);\r\n            edge.s({\r\n                'edge.width': 3,\r\n                'edge.offset': 10,                \r\n                'shape3d': 'cylinder',\r\n                'shape3d.opacity': 0.7,\r\n                'shape3d.transparent': true,\r\n                'shape3d.reverse.cull': true\r\n            });\r\n            dataModel.add(edge);\r\n            return edge;\r\n        }<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Heatmap\u70ed\u56fe\u901a\u8fc7\u4f17\u591a\u6570\u636e\u70b9\u4fe1\u606f\uff0c\u6c47\u805a\u6210\u76f4\u89c2\u53ef\u89c6\u5316\u989c\u8272\u6548\u679c\uff0c\u70ed\u56fe\u5df2\u5e7f\u6cdb\u88ab\u5e94\u7528\u4e8e\u6c14\u8c61\u9884\u62a5\u3001\u533b\u7597\u6210\u50cf\u3001\u673a\u623f\u6e29\u5ea6\u76d1\u63a7\u7b49\u884c\u4e1a\uff0c\u751a\u81f3\u5e94\u7528\u4e8e\u7ade\u6280\u4f53\u80b2\u9886\u57df\u7684\u6570\u636e\u5206\u6790\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/Viz-Libero-heat-map1.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-217\" alt=\"Viz Libero heat map\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/Viz-Libero-heat-map1.png\" width=\"700\" height=\"387\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/Viz-Libero-heat-map1.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/Viz-Libero-heat-map1-300x165.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/Viz-Libero-heat-map1-200x110.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>\u5df2\u6709\u4f17\u591a\u6587\u7ae0\u5206\u4eab\u4e86\u751f\u6210Heatmap\u70ed\u56fe\u539f\u7406\uff0c\u53ef\u53c2\u8003\u300a<a href=\"http:\/\/blog.corunet.com\/how-to-make-heat-maps\/\">How to make heat maps<\/a>\u300b\u548c\u300a<a href=\"http:\/\/michaelvandaniker.com\/blog\/2008\/07\/06\/how-to-make-heat-maps-in-flex\/\">How to make heat maps in Flex<\/a>\u300b\uff0c\u672c\u6587\u5c06\u4ecb\u7ecd\u57fa\u4e8eHTML5\u6280\u672f\u7684\u5b9e\u73b0\u65b9\u5f0f\uff0c\u4e3b\u8981\u57fa\u4e8eCavans\u548cWebGL\u8fd9\u4e24\u79cdHTML5\u76842D\u548c3D\u6280\u672f\u7684\u5e94\u7528\uff0c\u5148\u4e0a\u6700\u7ec8\u4f8b\u5b50\u5b9e\u73b0\u7684\u754c\u9762\u6548\u679c\u548c<a href=\"http:\/\/v.youku.com\/v_show\/id_XNzc5ODYxNjY4.html?firsttime=0\">\u64cd\u4f5c\u89c6\u9891<\/a>\uff1a<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/IMG_10361.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-216\" alt=\"IMG_1036\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/IMG_10361.jpg\" width=\"700\" height=\"525\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/IMG_10361.jpg 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/IMG_10361-300x225.jpg 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/09\/IMG_10361-200x150.jpg 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p><iframe loading=\"lazy\" src=\"http:\/\/player.youku.com\/embed\/XNzc5ODYxNjY4\" height=\"498\" width=\"510\" allowfullscreen=\"\" frameborder=\"0\"><\/iframe><br \/>\n\u5b9e\u73b0Heatmap\u7684\u5f00\u6e90js\u5e93\u6bd4\u8f83\u51fa\u540d\u7684\u5c31\u662f\u00a0<a href=\"http:\/\/www.patrick-wied.at\/static\/heatmapjs\/\">heatmapjs<\/a>\u00a0\uff0c\u8be5\u6846\u67b6\u53d1\u5c55\u4e862\u5e74\u591a\uff0c\u4f5c\u8005Patrick Wied\u6700\u8fd1\u51b3\u5b9a\u5728\u4fdd\u6301\u5f00\u6e90\u7684\u57fa\u7840\u4e0a\uff0c\u63d0\u4f9b\u6709\u507f\u7684\u5546\u4e1a\u652f\u6301\u670d\u52a1\uff0c\u8fd9\u662f\u597d\u4e8b\uff0c\u5730\u7403\u4e0a\u7edd\u5927\u90e8\u5206\u5f00\u6e90\u9879\u76ee\u4f5c\u8005\u641e\u4e2abarely\u53ef\u7528\u7684\u521d\u7ea7\u7248\u672c\u540e\uff0c\u5c31\u591a\u5e74\u4e0d\u89c1\u66f4\u65b0\u4e86\uff0c\u800c\u771f\u6b63\u80fd\u5b9e\u9645\u4e0a\u7ebf\u4f7f\u7528\u7684\u4ea7\u54c1\u54ea\u6709\u4e0d\u9700\u8981\u6301\u7eed\u5b8c\u5584\u3001\u589e\u5f3a\u53ef\u6269\u5c55\u6027\u4ee5\u53ca\u63d0\u4f9b\u7279\u6b8a\u5b9a\u5236\u670d\u52a1\u7684\uff0c\u8003\u8651\u5230\u4f5c\u8005\u8fd9\u4e24\u5e74\u5df2\u65e0\u507f\u6295\u4e86\u8fd9\u4e48\u591a\uff08<a href=\"http:\/\/www.patrick-wied.at\/static\/heatmapjs\/get-heatmap.html\">Over the last 2 years, I devoted\u00a0<strong>more than 500 hours<\/strong>\u00a0of work to improving heatmap.js to make it a truly great library.<\/a>\u00a0\uff09\uff0c\u5e0c\u671b\u6b64\u6587\u4e5f\u80fd\u5e2e\u4f5c\u8005\u5728\u56fd\u5185\u8d77\u70b9\u5ba3\u4f20\u4f5c\u7528\u3002<\/p>\n<p><a href=\"http:\/\/www.patrick-wied.at\/static\/heatmapjs\/\">heatmapjs<\/a>\u00a0\u91c7\u7528\u7684Canvas\u76842D\u7ed8\u5236\u65b9\u5f0f\u5b9e\u73b0\uff0c\u8fd9\u79cd\u57fa\u4e8eCPU\u7684\u7ed8\u5236\u65b9\u5f0f\u5bf9\u4e8e\u51e0\u767e\u51e0\u5343\u7684\u70b9\u8fd8\u51d1\u5408\uff0c\u4f46\u5982\u679c\u9700\u8981\u5b9e\u65f6\u8fd0\u7b97\u6210\u5343\u4e0a\u4e07\u8282\u70b9\u6548\u679c\u7684\uff0c\u8fd8\u662f\u5f97\u4f9d\u9760\u5e76\u53d1\u6027\u66f4\u5f3a\u5927\u7684GPU\u65b9\u5f0f\uff0c\u91c7\u7528HTML5\u7684\u8bdd\u53ea\u80fd\u662fWebGL\u65b9\u6848\uff0c\u8fd8\u597dFlorian Boesch\u5728\u300a<a href=\"http:\/\/codeflow.org\/entries\/2013\/feb\/04\/high-performance-js-heatmaps\">High Performance JS heatmaps<\/a>\u300b\u535a\u5ba2\u4e2d\u63d0\u4f9b\u4e86\u57fa\u4e8eWebGL\u5b9e\u73b0\u7684heatmap\u65b9\u5f0f\uff0c\u5e76\u5c06\u5176\u5f00\u6e90\u5728<a href=\"https:\/\/github.com\/pyalot\/webgl-heatmap\">https:\/\/github.com\/pyalot\/webgl-heatmap\u00a0<\/a>\u00a0\u4e0a\uff0c\u8fd9\u4e24\u4e2a\u5f00\u6e90\u5e93\u8d28\u91cf\u90fd\u8fd8\u4e0d\u9519\uff0c\u4e00\u4e2a\u57fa\u4e8eCanvas\u5b9e\u73b0\uff0c\u4e00\u4e2a\u57fa\u4e8eWebGL\u5b9e\u73b0\uff0c\u540e\u8005\u6027\u80fd\u9ad8\u70b9\uff0c\u4f46\u9700\u8981\u652f\u6301WebGL\u7684\u6d4f\u89c8\u5668\uff0c<a href=\"http:\/\/www.patrick-wied.at\/static\/heatmapjs\/\">heatmapjs<\/a>\u00a0\u7684\u6587\u6863\u4f8b\u5b50\u6bd4\u8f83\u5168\u9762\uff0c\u4f46\u4e24\u8005\u63a5\u53e3\u90fd\u975e\u5e38\u7b80\u5355\u6613\u5b66\uff0c\u4ee3\u7801\u4e5f\u90fd\u5c31\u51e0\u767e\u884c\uff0c\u4f60\u5b8c\u5168\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u60c5\u51b5\u9009\u62e9\u751a\u81f3\u8fdb\u884c\u4ee3\u7801\u6539\u9020\u4f18\u5316\u3002<\/p>\n<p>\u56de\u5230\u6211\u4eec\u8981\u5b9e\u73b0\u7684\u4f8b\u5b50\uff0c\u6211\u5c06\u91c7\u7528<a href=\"http:\/\/www.patrick-wied.at\/static\/heatmapjs\/\">heatmapjs<\/a>\u5728\u5185\u5b58\u4e2d\u5b9e\u65f6\u8fd0\u7b97\u51fa\u70ed\u56fe\uff0c\u7ed3\u5408<a href=\"http:\/\/www.hightopo.com\/\">hightopo<\/a>\u7684<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u76843D\u5f15\u64ce\uff0c\u4ee5\u4e00\u5806\u8282\u70b9\u8fde\u7ebf\u5173\u7cfb\u76843D\u7684\u7f51\u7edc\u62d3\u6251\u56fe\uff0c\u5176\u4e2d\u8282\u70b9\u4ee3\u8868\u70ed\u6e90\uff0c\u5176\u8d8a\u63a5\u8fd1\u5730\u9762\u5219\u5730\u9762\u6e29\u5ea6\u8d8a\u9ad8\uff0c\u8fd9\u6837\u6bcf\u4e2a\u8282\u70b9\u7684xz\u9762\u5750\u6807\u4fe1\u606f\u4f5c\u4e3a\u8981\u4f20\u5165\u7ed9heatmapjs\u7684\u70b9xy\u4e8c\u7ef4\u5750\u6807\u4fe1\u606f\uff0c\u4e09\u7ef4\u8282\u70b9\u7684elevation\u4e5f\u5c31\u662fy\u8f74\u4fe1\u606f\uff0c\u5219\u4f5c\u4e3a\u79bb\u5730\u9762\u7684\u8ddd\u79bb\u4fe1\u606f\uff0c\u8ddd\u79bb\u8d8a\u5927\u8f6c\u6210\u8981\u4f20\u5165heatmapjs\u7684value\u503c\u8d8a\u5c0f\uff0c\u6700\u540e\u542f\u52a8<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u7684\u4e09\u7ef4\u62d3\u6251\u81ea\u52a8\u5e03\u5c40\u5f39\u529b\u7b97\u6cd5\uff0c\u8fd9\u6837\u53ef\u76f4\u89c2\u7684\u89c2\u5bdf\u56fe\u5143\u8282\u70b9\u5728\u4e0d\u540c\u7684\u7a7a\u95f4\u4f4d\u7f6e\u52a8\u6001\u53d8\u5316\u65f6\u5730\u677f\u7684\u6e29\u5ea6\u70ed\u56fe\u53d8\u5316\u6548\u679c\u3002<\/p>\n<p>\u4ee3\u7801\u6838\u5fc3\u5c31\u5728\u91cd\u8f7dforceLayout.onRelaxed\u51fd\u6570\uff0c\u5728\u6bcf\u6b21\u81ea\u52a8\u5e03\u5c40\u8fc7\u7a0b\u5c06\u6240\u6709\u70ed\u6e90\u8282\u70b9\u7684\u4fe1\u606f\u6784\u5efa\u6210heatmap\u9700\u8981\u7684\u6570\u636e\uff0c\u540c\u65f6\u901a\u8fc7ht.Default.setImage(&#8216;hm-bottom&#8217;, heatmap._renderer.canvas);\u5c06\u70ed\u56fe\u7684canvas\u6ce8\u518c\u6210<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684\u56fe\u7247\uff0c\u800cfloor\u7684\u5730\u677f\u56fe\u5143\u7ed1\u5b9a\u4e86\u6ce8\u518c\u7684&#8217;hm-bottom&#8217;\u56fe\u7247\uff0c\u8fd9\u6837\u5c31\u5b9e\u73b0\u4e86\u5185\u5b58\u7ed8\u5236canvas\uff0c\u7136\u540e\u901a\u8fc7<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u76843D\u5f15\u64ce\u5c06Cavnas\u4f5c\u4e3a\u8d34\u56fe\u4fe1\u606f\u52a8\u6001\u5448\u73b0\u52303D\u573a\u666f\u7684\u6548\u679c\u3002<\/p>\n<p>\u6574\u4e2a\u5b9e\u73b0\u4ee3\u7801\u5982\u4e0b\u4e0d\u5230\u767e\u884c\uff0c\u4f60\u4e5f\u53ef\u4ee5\u91c7\u7528<a href=\"https:\/\/github.com\/pyalot\/webgl-heatmap\">https:\/\/github.com\/pyalot\/webgl-heatmap\u00a0<\/a>\u7684WebGL\u65b9\u5f0f\u6765\u5b9e\u73b0\uff0c\u8fd9\u6837\u5c31\u662f3D\u52302D\u518d\u52303D\u7684\u6709\u8da3\u8fc7\u7a0b\uff0c\u8fd9\u5c31\u662fHTML5\u6280\u672f\u53ef\u65e0\u7f1d\u878d\u5408\u5404\u79cd\u65b9\u6848\u7684\u9b45\u529b\uff01<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">        MAX = 500;\r\n        WIDTH = 1024;\r\n        HEIGHT = 512;        \r\n        function init() {                           \r\n            dataModel = new ht.DataModel();            \r\n            g3d = new ht.graph3d.Graph3dView(dataModel);                            \r\n            g3d.getMoveMode = function(e){ return 'xyz'; };                        \r\n            view = g3d.getView();            \r\n            view.className = 'main';\r\n            document.body.appendChild(view);    \r\n            window.addEventListener('resize', function (e) { g3d.invalidate(); }, false); \r\n            heatmap = h337.create({ width: WIDTH, height: HEIGHT });               \r\n            ht.Default.setImage('hm-bottom', heatmap._renderer.canvas);            \r\n            var floor = new ht.Node();\r\n            floor.s3(WIDTH, 1, HEIGHT);\r\n            floor.s({\r\n                '3d.selectable': false,\r\n                'layoutable': false,\r\n                'all.visible': false,\r\n                'top.visible': true,\r\n                'top.image': 'hm-bottom',\r\n                'top.reverse.flip': true,\r\n                'bottom.visible': true,\r\n                'bottom.transparent': true,\r\n                'bottom.opacity': 0.5,\r\n                'bottom.reverse.flip': true                \r\n            });\r\n            dataModel.add(floor);            \r\n            var root = createNode();                   \r\n            for (var i = 0; i &lt; 3; i++) {\r\n                var iNode = createNode();                       \r\n                createEdge(root, iNode);\r\n                for (var j = 0; j &lt; 3; j++) {                     var jNode = createNode();                                                 createEdge(iNode, jNode);                                                                          }             }                                forceLayout = new ht.layout.Force3dLayout(g3d);               forceLayout.setEdgeRepulsion(1);             forceLayout.start();             forceLayout.onRelaxed = function(){                 var points = [];                 dataModel.each(function(data){                     if(data instanceof ht.Node &amp;&amp; data !== floor){                         var p3 = data.p3();                         if(p3[1] &gt; MAX){\r\n                            p3[1] = MAX;\r\n                            data.setElevation(MAX);\r\n                        }\r\n                        else if(p3[1] &lt; -MAX){\r\n                            p3[1] = -MAX;\r\n                            data.setElevation(-MAX);\r\n                        }                        \r\n                        points.push({\r\n                            x: p3[0] + WIDTH\/2,\r\n                            y: p3[2] + HEIGHT\/2,\r\n                            value: MAX - Math.abs(p3[1])\r\n                        });\r\n                    }\r\n                });\r\n                heatmap.setData({data: points, min: 0, max: MAX});\r\n            };\r\n        }\r\n        function createNode(){\r\n            var node = new ht.Node();             \r\n            node.s({\r\n                'shape3d': 'sphere',\r\n                'shape3d.color': '#E74C3C',\r\n                'shape3d.opacity': 0.8,\r\n                'shape3d.transparent': true,\r\n                'shape3d.reverse.cull': true\r\n            });\r\n            node.s3(20, 20, 20);\r\n            dataModel.add(node);\r\n            return node;\r\n        }\r\n        function createEdge(sourceNode, targetNode){\r\n            var edge = new ht.Edge(sourceNode, targetNode);\r\n            edge.s({\r\n                'edge.width': 3,\r\n                'edge.offset': 10,                \r\n                'shape3d': 'cylinder',\r\n                'shape3d.opacity': 0.7,\r\n                'shape3d.transparent': true,\r\n                'shape3d.reverse.cull': true\r\n            });\r\n            dataModel.add(edge);\r\n            return edge;\r\n        }<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/213"}],"collection":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/comments?post=213"}],"version-history":[{"count":5,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/213\/revisions"}],"predecessor-version":[{"id":222,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/213\/revisions\/222"}],"wp:attachment":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/media?parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/categories?post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/tags?post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}