{"id":189,"date":"2014-08-10T23:53:02","date_gmt":"2014-08-10T15:53:02","guid":{"rendered":"http:\/\/www.hightopo.com\/blog\/?p=189"},"modified":"2014-08-10T23:53:02","modified_gmt":"2014-08-10T15:53:02","slug":"ht%e5%9b%be%e5%bd%a2%e7%bb%84%e4%bb%b6%e8%ae%be%e8%ae%a1%e4%b9%8b%e9%81%93%ef%bc%88%e4%b8%80%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.hightopo.com\/blog\/189.html","title":{"rendered":"HT\u56fe\u5f62\u7ec4\u4ef6\u8bbe\u8ba1\u4e4b\u9053\uff08\u4e00\uff09"},"content":{"rendered":"<p><a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u7b80\u79f0<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u63d0\u4f9b\u4e86\u6db5\u76d6\u901a\u7528\u7ec4\u4ef6\u30012D\u62d3\u6251\u56fe\u5f62\u7ec4\u4ef6\u4ee5\u53ca3D\u5f15\u64ce\u7684\u4e00\u7ad9\u5f0f\u89e3\u51b3\u65b9\u6848\uff0c\u6b63\u5982<a href=\"http:\/\/www.hightopo.com\/\">Hightopo\u5b98\u7f51<\/a>\u6240\u8868\u8fbe\u7684\u6211\u4eec\u5e0c\u671b\u63d0\u4f9b\uff1aEverything you need to create cutting-edge 2D and 3D visualization. \u8fd9\u4e2a\u613f\u666f\u4ece\u529f\u80fd\u4e0a\u662f\u4e2a\u76f8\u5f53\u957f\u7684\u6218\u7ebf\uff0c\u4ece\u8bbe\u8ba1\u67b6\u6784\u4e0a\u4e5f\u662f\u6781\u5177\u6311\u6218\u6027\u7684\uff0c\u5176\u5b9e<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u56e2\u961f\u662f\u975e\u5e38\u4fdd\u5b88\u7684\uff0c\u6211\u4eec\u4ece\u4e0d\u8d2a\u591a\u56fe\u5927\uff0c\u53ea\u505a\u6211\u4eec\u611f\u89c9\u81ea\u5df1\u80fd\u5f97\u66f4\u597d\uff0c\u80fd\u7ed9\u7528\u6237\u7efc\u5408\u4f53\u9a8c\u66f4\u4f73\u7684\u529f\u80fd\uff0c\u5728\u8fd9\u6837\u7406\u5ff5\u9a71\u52a8\u4e0b\u6211\u4eec\u6162\u6162\u5f62\u6210\u4e86\u8fd9\u6837\u7684\u613f\u666f\uff0c\u6162\u6162\u5b9e\u73b0\u4e86\u51e0\u4e2a\u6709\u610f\u4e49\u7684\u91cc\u7a0b\u7891\uff0c\u6162\u6162\u79ef\u7d2f\u4e0b\u4e86\u4e0d\u5c11\u56fe\u5f62\u7ec4\u4ef6\u8bbe\u8ba1\u4e0a\u7684\u521b\u65b0\u548c\u7ecf\u9a8c\uff0c\u6211\u4e0d\u77e5\u9053\u8fd9\u4e2a\u7cfb\u5217\u4f1a\u5199\u591a\u5c11\u7bc7\uff0c\u4e5f\u8bb8\u6c38\u8fdc\u4e5f\u4e0d\u4f1a\u7ed3\u675f\uff0c\u4e5f\u6ca1\u6709\u7cfb\u7edf\u7684\u63d0\u7eb2\u89c4\u5212\uff0c\u60f3\u5230\u4ec0\u4e48\u5c31\u5199\u4ec0\u4e48\uff0c\u53ea\u5e0c\u671b\u6587\u7ae0\u80fd\u542f\u53d1\u6709\u5174\u8da3\u7684\u540c\u5b66\u5bf9\u56fe\u5f62\u7ec4\u4ef6\u8bbe\u8ba1\u66f4\u6df1\u7684\u601d\u8003\u5c31\u8db3\u591f\u4e86\u3002<\/p>\n<p>\u8ba8\u8bba\u524d\u5148\u8bbe\u5b9a\u8bdd\u9898\u7684\u8fb9\u754c\uff0c<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u662f\u57fa\u4e8eHTML5\u7684\u56fe\u5f62\u7ec4\u4ef6\u5e93\uff0c\u56e0\u6b64\u6587\u7ae0\u7684\u6848\u4f8b\u66f4\u591a\u4f1a\u6d89\u53caHTML\u548cJavaScript\u8bed\u8a00\uff0c\u4f46\u5e76\u4e0d\u5c40\u9650\u4e8eWeb\u524d\u7aef\uff0c\u8bbe\u8ba1\u601d\u60f3\u4e0a\u540c\u6837\u9002\u7528\u4e8e\u4efb\u4f55GUI\u8bed\u8a00\u5e73\u53f0\u3002\u5b8c\u6574\u7684\u524d\u7aef\u8bbe\u8ba1\u662f\u9700\u8981\u8003\u8651\u5230\u540e\u53f0\u52a0\u8f7d\u5e76\u53d1\u7b49\u56e0\u7d20\uff0c\u4f46\u672c\u7cfb\u5217\u66f4\u4fa7\u91cd\u4e8e\u7eaf\u5ba2\u6237\u7aef\u56fe\u5f62\u7ec4\u4ef6\uff0c\u4e0d\u6d89\u53ca\u7f51\u7edc\u901a\u8baf\u90e8\u5206\u7684\u601d\u8003\uff0c\u4f8b\u5982\u6700\u8fd1<a href=\"http:\/\/weibo.com\/p\/1001603741249222874725\">\u963f\u91cc\u65e0\u7ebf\u524d\u7aef\u62db\u8058<\/a>\u8ba9\u8c08\u8c08\uff1a\u8bb2\u8bb2\u8f93\u5165\u5b8c\u7f51\u5740\u6309\u4e0b\u56de\u8f66\uff0c\u5230\u770b\u5230\u7f51\u9875\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\u53d1\u751f\u4e86\u4ec0\u4e48\u3002\u8fd9\u662f\u4e2a\u80fd\u8ba8\u8bba\u51fa\u5f88\u591a\u65b9\u65b9\u9762\u9762\uff0c\u8ba9\u4f60\u4e86\u89e3\u9762\u8bd5\u8005\u7684\u597d\u8bdd\u9898\uff0c\u4f46\u8fd9\u91cc\u8ba8\u8bba\u7684\u8bdd\u9898\u4f1a\u4e0e\u4ee5\u4e0b\u5173\u952e\u5b57\u66f4\u4e3a\u76f8\u5173\uff1a\u4f01\u4e1a\u5e94\u7528\u3001Single Page Application\u3001\u91cd\u5ba2\u6237\u7aef\u4ea4\u4e92\u3001\u76d1\u63a7\u3001MV*\u7b49\u3002<\/p>\n<p>\u5982Linus\u5927\u795e\u6240\u8a00\uff1aTalk\u00a0is\u00a0cheap,\u00a0show\u00a0me\u00a0the\u00a0code.\u00a0 \u56e0\u6b64\u6211\u9009\u62e9\u5728\u8bdd\u9898\u5c55\u5f00\u4e4b\u524d\uff0c\u5148\u7528HT\u6765\u6269\u5c55\u5b9a\u5236\u51e0\u4e2a\u5e94\u7528\u6848\u4f8b\uff0c\u4ee5\u4fbf\u5927\u5bb6\u4e86\u89e3<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7ec4\u4ef6\u53ca\u5176\u6269\u5c55\u8bbe\u8ba1\u601d\u8def\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/1282039088303.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-190\" alt=\"1282039088303\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/1282039088303.jpg\" width=\"536\" height=\"334\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/1282039088303.jpg 536w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/1282039088303-300x186.jpg 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/1282039088303-200x124.jpg 200w\" sizes=\"(max-width: 536px) 100vw, 536px\" \/><\/a><\/p>\n<p>\u719f\u6089Flex\u7684\u7a0b\u5e8f\u5458\u5e94\u8be5\u90fd\u4e86\u89e3<a href=\"http:\/\/www.adobe.com\/devnet\/flex\/tourdeflex.html\">Tour de Flex<\/a>\u8fd9\u4e2a\u5305\u7f57\u4e07\u8c61\u7684\u5927\u6742\u70e9\uff0c\u5176\u4e2d\u7684\u7f51\u7edc\u76d1\u63a7\u62d3\u6251<a href=\"http:\/\/www.adobe.com\/devnet\/flex\/samples\/network_monitor.html\">Network Monitor<\/a>\u7279\u522b\u5176\u52a8\u753b\u5207\u6362\u6548\u679c\u4e00\u76f4\u7ed9\u6211\u5f88\u6df1\u5370\u8c61\uff0c\u8fd9\u91cc\u4e0d\u53ef\u80fd\u6709\u7bc7\u5e45\u5b9e\u73b0\u5b8c\u6574\u4f8b\u5b50\uff0c\u6211\u4eec\u4ec5\u5c1d\u8bd5\u5b9e\u73b0\u5176\u5c55\u793aCPU\u548cMEM\u7684\u754c\u9762\u90e8\u5206\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/IMG_3641.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-191\" alt=\"IMG_3641\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/IMG_3641.jpg\" width=\"664\" height=\"498\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/IMG_3641.jpg 664w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/IMG_3641-300x225.jpg 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/IMG_3641-200x150.jpg 200w\" sizes=\"(max-width: 664px) 100vw, 664px\" \/><\/a><\/p>\n<p>\u5b9e\u73b0\u7684\u6700\u7ec8\u6548\u679c\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u6a21\u578b\u6570\u636e\u5c31\u4e24\u4e2a\u6570\u503c\uff0c\u4e00\u4e2a\u4ee3\u8868CPU\u5360\u7528\u7387\uff0c\u4e00\u4e2a\u4ee3\u8868\u5185\u5b58\u5360\u7528\u7387\uff0c\u5de6\u4fa7\u901a\u8fc7<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684\u56fe\u5f62\u7ec4\u4ef6GraphView\u81ea\u5b9a\u4e49\u4e86\u77e2\u91cf\u56fe\u5f62\u5c55\u793a\uff0c\u53f3\u4e0a\u89d2\u81ea\u5b9a\u4e49\u4e86\u5c5e\u6027\u9875PropertyView\u7684\u4e24\u5355\u5143\u683c\u7684Renderer\uff0c\u53f3\u4e0b\u89d2\u4e24\u4e2aSlider\u53ef\u62d6\u52a8\u6539\u53d8CPU\u548cMEN\u503c\u3002<\/p>\n<p>\u6b64\u4f8b\u5b50\u9ebb\u96c0\u867d\u5c0f\u4e94\u810f\u4ff1\u5168\uff0c\u4e09\u4e2a\u90e8\u5206\u5206\u522b\u91c7\u7528\u4e09\u79cd\u65b9\u5f0f\u5b9e\u73b0\u4e86\u81ea\u5b9a\u4e49\u7ec4\u4ef6\uff0c\u540c\u65f6\u4e0d\u540c\u7ec4\u4ef6\u5171\u4eab\u540c\u4e00\u6570\u636e\u6e90\uff0c\u5728\u5448\u73b0\u7684\u57fa\u7840\u4e0a\u8fd8\u652f\u6301\u684c\u9762\u548c\u79fb\u52a8\u7aef\u7684Mouse\u548cTouch\u7684\u4ea4\u4e92\uff0c\u8fd8\u6709\u4e0d\u540c\u7ec8\u7aef\u5c4f\u5e55\u7684\u7ec4\u4ef6\u5e03\u5c40\u529f\u80fd\u3002<\/p>\n<p>\u4e1a\u52a1\u4e0a\u9700\u8981\u5728\u5360\u7528\u7387\u5c0f\u4e8e40%\u65f6\u5448\u73b0\u5f8b\u5e08\uff0c40%-70%\u65f6\u663e\u793a\u9ec4\u8272\uff0c\u8d85\u8fc770%\u65f6\u5448\u73b0\u7ea2\u8272\uff0c\u56e0\u6b64\u5b9a\u4e49\u4e86\u5982\u4e0bgetColor\u7684\u5de5\u5177\u51fd\u6570\uff1a<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">\tgetColor = function(value) {\r\n\t\tif (value &lt; 40)\r\n\t\t\treturn '#00A406';\r\n\t\tif (value &lt; 70)\r\n\t\t\treturn '#FFCC00';\r\n\t\treturn '#A60000';\r\n\t};<\/pre>\n<p>PropertyView\u4e0a\u91c7\u7528\u7684\u6700\u57fa\u7840\u548c\u539f\u59cb\u7684\u65b9\u5f0f\uff0c\u901a\u8fc7Canvas\u753b\u7b14\u8fdb\u884c\u5355\u5143\u683c\u7684\u81ea\u5b9a\u4e49\u7ed8\u5236\uff0c\u5728\u6ce8\u518cPropertyView\u65f6\u91cd\u8f7ddrawPropertyValue\u51fd\u6570\u5373\u53ef\u5b9e\u73b0\u5355\u5143\u683c\u81ea\u5b9a\u4e49Renderer\u7684\u7ed8\u5236<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">drawFunc = function(g, value, x, y, w, h){\r\n\tg.fillStyle = '#A1A1A3';\r\n\tg.beginPath();\r\n\tg.rect(x, y, w, h);\r\n\tg.fill();                    \r\n\tg.fillStyle = getColor(value);\r\n\tg.beginPath();\r\n\tg.rect(x, y, w * value \/ 100, h);\r\n\tg.fill();\r\n\tht.Default.drawText(g, value + '%', '12px Arial', 'white', x, y, w, h, 'center'); \r\n};\r\npropertyView.addProperties([\r\n\t{\r\n\t\tdisplayName: 'CPU',\r\n\t\tdrawPropertyValue: function(g, property, value, rowIndex, x, y, w, h, data, view) \t{\r\n\t\t\tdrawFunc(g, data.a('cpu'), x, y, w, h);\r\n\t\t}\r\n\t},\r\n\t{\r\n\t\tdisplayName: 'MEM',\r\n\t\tdrawPropertyValue: function(g, property, value, rowIndex, x, y, w, h, data, view) {\r\n\t\t\tdrawFunc(g, data.a('mem'), x, y, w, h);\r\n\t\t}        \r\n\t}\r\n]);<\/pre>\n<p>Slider\u62c9\u6761\u90e8\u5206\u76f4\u63a5\u5728HT\u5c01\u88c5\u7684\u7ec4\u4ef6\u4e4b\u4e0a\u5e94\u7528\uff0c\u56e0\u800c\u65e0\u9700\u63a5\u89e6\u5230\u6700\u5e95\u5c42\u7684Canvas\u753b\u7b14\u7ed8\u5236\uff0c\u4ec5\u9700\u8981\u5728onValueChanged\u65f6\u66f4\u65b0leftBackgroud\u62c9\u6761\u5de6\u4fa7\u989c\u8272\u5373\u53ef\uff0c\u5176\u5b9e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u91cd\u8f7dSlider\u7684getLeftBackground\u51fd\u6570\u5b9e\u73b0\uff1a<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">formPane.addRow(['CPU', {\r\n\tslider: {\r\n\t\tstep: 1,\r\n\t\tonValueChanged: function(){\r\n\t\t\tvar value = this.getValue();\r\n\t\t\tnode.a('cpu', value);\r\n\t\t\tthis.setLeftBackground(getColor(value));\r\n\t\t},\r\n\t\tvalue: node.a('cpu')        \r\n\t}\r\n}], [50, 0.1]);\r\nformPane.addRow(['MEM', {\r\n\tslider: {\r\n\t\tstep: 1,                        \r\n\t\tonValueChanged: function(){\r\n\t\t\tvar value = this.getValue();\r\n\t\t\tnode.a('mem', value);\r\n\t\t\tthis.setLeftBackground(getColor(value));\r\n\t\t},\r\n\t\tvalue: node.a('mem')        \r\n\t}\r\n}], [50, 0.1]);<\/pre>\n<p>GraphView\u90e8\u5206\u91c7\u7528\u4e86\u300a<a href=\"http:\/\/www.hightopo.com\/blog\/175.html\">HT\u5168\u77e2\u91cf\u5316\u7684\u56fe\u5f62\u7ec4\u4ef6\u8bbe\u8ba1<\/a>\u300b\u6587\u7ae0\u4ecb\u7ecd\u7684HT\u81ea\u5b9a\u4e49\u7684\u77e2\u91cf\u65b9\u5f0f\u6765\u5b9e\u73b0\u56fe\u5f62\u6548\u679c\uff0c\u8fd9\u79cd\u65b9\u5f0f\u4ecb\u4e8e\u4ee5\u4e0a\u4e24\u79cd\u6269\u5c55\u65b9\u5f0f\u4e4b\u95f4\uff0c\u9700\u8981\u81ea\u5b9a\u4e49\u7ed8\u5236\u6548\u679c\uff0c\u4f46\u901a\u8fc7HT\u63d0\u4f9b\u7684\u77e2\u91cf\u683c\u5f0f\uff0c\u7528\u6237\u53ef\u91c7\u7528\u8f83\u4e3a\u76f4\u89c2\u6613\u8bfb\u7684JSON\u683c\u5f0f\u6765\u63cf\u8ff0\u56fe\u5f62\uff0c\u5e76\u901a\u8fc7\u6570\u636e\u7ed1\u5b9a\u7684\u65b9\u5f0f\u5b9e\u73b0\u6a21\u578b\u6570\u636e\u4e0e\u754c\u9762\u5448\u73b0\u7684\u5173\u8054\uff0c\u907f\u514d\u5982\u7b2c\u4e00\u79cd\u81ea\u5b9a\u4e49renderer\u7684\u65b9\u5f0f\uff0c\u5373\u9700\u8981\u63a5\u89e6\u5230\u5e95\u5c42\u7ed8\u5236\u51fd\u6570\uff0c\u540c\u65f6\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801\u4e0e\u7ed8\u5236\u4ee3\u7801\u6df7\u6742\u4e00\u8d77\u4e0d\u6613\u7ef4\u62a4\u7684\u95ee\u9898\u3002<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">ht.Default.setImage('server_image', {\r\n\twidth: 300,\r\n\theight: 200,\r\n\tcomps: [\r\n\t\t{\r\n\t\t\ttype: \"roundRect\",\r\n\t\t\trect: [3, 5, 291, 189],\r\n\t\t\tbackground: \"#E3E3E3\",\r\n\t\t\tgradient: \"linear.northeast\",\r\n\t\t\tshadow: true\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"text\",\r\n\t\t\ttext: \"CPU\",\r\n\t\t\tfont: \"16px Arial\",\r\n\t\t\trect: [20, 45, 59, 41]\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"text\",\r\n\t\t\ttext: \"MEM\",\r\n\t\t\tfont: \"16px Arial\",\r\n\t\t\trect: [20, 108, 59, 41]\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"rect\",\r\n\t\t\trect: [82, 55, 145, 22],\r\n\t\t\tbackground: \"#A1A1A3\"\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"rect\",\r\n\t\t\trect: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn [82, 55, 145 * data.a('cpu') \/ 100, 22];\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tbackground: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn getColor(data.a('cpu'));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"rect\",\r\n\t\t\trect: [82, 117, 145, 22],\r\n\t\t\tbackground: \"#A1A1A3\"\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"rect\",\r\n\t\t\trect: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn [82, 117, 145 * data.a('mem') \/ 100, 22];\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tbackground: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn getColor(data.a('mem'));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"text\",\r\n\t\t\tfont: \"16px Arial\",\r\n\t\t\trect: [240, 49, 53, 31],\r\n\t\t\ttext: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn data.a('cpu') + '%';\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tcolor: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn getColor(data.a('cpu'));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"text\",\r\n\t\t\tfont: \"16px Arial\",\r\n\t\t\trect: [240, 108, 47, 39],\r\n\t\t\ttext: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn data.a('mem') + '%';\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tcolor: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn getColor(data.a('mem'));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n});<\/pre>\n<p>\u4ee5\u4e0a\u4ee3\u7801\u6ce8\u518c\u4e86\u540d\u4e3aserver-image\u7684\u56fe\u7247\uff0c\u7ed1\u5b9a\u4e86attr\u4e0a\u7684mem\u548ccpu\u7684\u4e24\u4e2a\u5c5e\u6027\uff0c\u56e0\u6b64\u505a\u5b8c\u8fd9\u4e9b\u624b\u811a\u67b6\u7684\u57fa\u7840\u5de5\u4f5c\u540e\uff0c\u5e94\u7528\u4eba\u5458\u53ea\u9700\u8981\u6784\u5efaht.Node\u5bf9\u8c61\uff0c\u901a\u8fc7node.setImage(&#8216;server-image&#8217;)\u5373\u53ef\u5b9e\u73b0\u8be5\u56fe\u5143\u5728GraphView\u4e0a\u5448\u73b0&#8217;server-image&#8217;\u63cf\u8ff0\u7684\u77e2\u91cf\u6548\u679c\uff0c\u5e76\u4e14PropertyView\u3001Slider\u548cGraphView\u4e09\u4e2a\u7ec4\u4ef6\u90fd\u901a\u8fc7node\u7684attr\u4e0a\u7684cpu\u548cmem\u6765\u663e\u793a\u754c\u9762\uff0c\u8fd9\u6837\u5f53\u540e\u53f0\u83b7\u53d6\u5230\u91c7\u96c6\u7684\u5b9e\u65f6\u6570\u636e\u540e\uff0c\u53ea\u9700\u8981\u66f4\u65b0\u5230node\u7684attr\u4e0a\u7684cpu\u548cmem\u5c5e\u6027\uff0c\u5219\u754c\u9762\u4e0a\u7684\u6240\u6709\u7ec4\u4ef6\u5c31\u4f1a\u81ea\u5b9a\u66f4\u65b0\u663e\u793a\uff1a<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">node = new ht.Node();\r\nnode.setName('SERVER');\r\nnode.setImage('server_image');\r\nnode.a({\r\n\tcpu: 30,\r\n\tmem: 70\r\n});\r\ndataModel.add(node);<\/pre>\n<p>\u5f53\u7136\u5b9e\u9645\u5e94\u7528\u4e2d\u5e76\u4e0d\u9700\u8981\u62c9\u6761\u6539\u53d8CPU\u548cMEN\u503c\uff0c\u8fd9\u4e9b\u503c\u4e00\u822c\u901a\u8fc7\u540e\u53f0\u91c7\u96c6\u5b9e\u65f6\u81ea\u52a8\u66f4\u65b0\u4ec5\u4f5c\u4e3a\u5448\u73b0\uff0c\u4f46\u6709\u4e86\u524d\u7aef\u8fd9\u4e9b\u7ec4\u4ef6\u7684\u4e00\u7ad9\u5f0f\u652f\u6301\uff0c\u6211\u4eec\u4e0d\u9700\u8981\u8fde\u63a5\u540e\u53f0\u4e5f\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5728\u5ba2\u6237\u7aef\u8fdb\u884c\u6a21\u62df\u6d4b\u8bd5\uff0c\u6709\u4e86\u8fd9\u6837\u7684\u673a\u5236\u6211\u4eec\u5c31\u53ef\u4ee5\u5206\u79bb\u6a21\u5757\u4e00\u6b65\u6b65\u6d4b\u8bd5\uff0c\u4f8b\u5982\u6211\u4eec\u73b0\u5728\u4e0d\u9700\u8981\u8fde\u63a5\u670d\u52a1\u5668\u4e5f\u53ef\u4ee5\u6d4b\u8bd5\u77e2\u91cf\u63cf\u8ff0\u5b9a\u4e49\u7684\u662f\u5426\u6b63\u786e\uff0c\u6570\u503c\u6539\u53d8\u540e\u7eff\u9ec4\u7ea2\u7684\u4e1a\u52a1\u989c\u8272\u66f4\u65b0\u662f\u5426\u6b63\u786e\uff0c\u5404\u4e2a\u7ec4\u4ef6\u7684\u6570\u636e\u540c\u6b65\u662f\u5426\u6b63\u5e38\uff0cMouse\u548cTouch\u4ea4\u4e92\u662f\u5426\u80fd\u6b63\u5e38\u64cd\u4f5c\uff0c\u754c\u9762\u5728\u4e0d\u540c\u8bbe\u5907\u5c4f\u5e55\u4e0a\u663e\u793a\u662f\u5426\u6b63\u5e38\u7b49\u7b49\uff0c\u8fd9\u4e9b\u7eaf\u5ba2\u6237\u7aef\u7ec4\u4ef6\u7684\u5c01\u88c5\u5de5\u4f5c\u90fd\u505a\u5230\u4f4d\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u5b89\u5fc3\u8fde\u63a5\u540e\u53f0\u6570\u636e\u8fdb\u884c\u6d4b\u8bd5\u4e86\u3002<\/p>\n<p>\u89c1\u8fc7\u592a\u591a\u5ba2\u6237\u51fa\u95ee\u9898\u65f6\u53ea\u4f1a\u8bf4\uff1a\u754c\u9762\u663e\u793a\u4e0d\u5bf9\u3002\u8fd9\u6837\u7684\u95ee\u9898\u63cf\u8ff0\u5b8c\u5168\u65e0\u6cd5\u5b9a\u4f4d\u6839\u6e90\uff0c\u5230\u5e95\u65f6\u540e\u53f0\u6570\u636e\u5e93\u95ee\u9898\uff0c\u7f51\u7edc\u901a\u8baf\u95ee\u9898\uff0c\u89e3\u6790\u6570\u636e\u95ee\u9898\uff0c\u8bbe\u7f6e\u6a21\u578b\u95ee\u9898\u8fd8\u662f\u7ec4\u4ef6\u5c01\u88c5\u95ee\u9898\uff1f\u8fd9\u4e5f\u662fMVC\/MVP\/MVVM\u5b58\u5728\u7684\u53e6\u5916\u4e00\u4e2a\u5c42\u9762\u7684\u610f\u4e49\uff0cMV*\u9664\u4e86\u4e8b\u4ef6\u6d3e\u53d1\u6570\u636e\u7ed1\u5b9a\u5916\uff0c\u80fd\u66f4\u597d\u7684\u8fdb\u884c\u5448\u73b0\u3001\u6a21\u578b\u548c\u4e1a\u52a1\u903b\u8f91\u7684\u5206\u5de5\u5207\u5272\u8fdb\u884c\u72ec\u7acb\u6d4b\u8bd5\u7684\u91cd\u8981\u610f\u4e49\uff0c\u5c31\u884cTCP\/IP\u4e03\u5c42\u534f\u8bae\u7684\u5206\u7c7b\uff0c\u6bcf\u4e2a\u534f\u8bae\u5c42\u90fd\u5e94\u8be5\u786e\u4fdd\u6b63\u786e\u5b9e\u73b0\u81ea\u5df1\u7684\u534f\u5b9a\u7ea6\u5b9a\uff0c\u5e76\u4e14\u6bcf\u4e00\u5c42\u53ef\u8fdb\u884c\u72ec\u7acb\u7684\u6d4b\u8bd5\uff0c\u8fd9\u624d\u662f\u53ef\u7ef4\u62a4\u53ef\u6269\u5c55\u7684\u7cfb\u7edf\uff0c\u56e0\u6b64\u5bf9\u4e8eHT\u5ba2\u6237\u9047\u5230\u95ee\u9898\u65f6\uff0c\u6211\u4eec\u4e00\u822c\u4e5f\u662f\u4e00\u5c42\u5c42\u7684\u5e2e\u5fd9\u68b3\u7406\u627e\u6839\u6e90\uff0c\u5982\u679c\u77e2\u91cf\u63cf\u8ff0\u6ca1\u95ee\u9898\u5448\u73b0\u51fa\u9519\uff0c\u90a3\u662fHT\u7ec4\u4ef6\u5e93\u7684\u95ee\u9898\uff0c\u5982\u679c\u6a21\u62df\u5230Node\u4e0a\u7684attr\u6570\u636e\u663e\u793a\u6b63\u786e\uff0c\u90a3\u5c31\u53bb\u627e\u627e\u5b9e\u9645\u8fd0\u884c\u540e\u53f0\u901a\u4fe1\u89e3\u6790\u540e\u7684\u6570\u636e\u662f\u5426\u6b63\u786e\u7684\u8bbe\u7f6e\u5230\u6a21\u578b\u4e0a\uff0c\u8fd9\u6837\u4e00\u6b65\u6b65\u7684\u5206\u6790\u5f88\u5bb9\u6613\u5c31\u80fd\u5b9a\u4f4d\u5230\u95ee\u9898\u7684\u6839\u6e90\u3002<\/p>\n<p>\u4ee5\u4e0a\u4e09\u79cd\u6269\u5c55\u65b9\u5f0f\u5404\u6709\u5229\u5f0a\uff0c\u6211\u5c06\u5728\u4e0b\u7bc7\u4e2d\u7ee7\u7eed\u5c55\u5f00\u5206\u6790\uff0c\u672c\u7bc7\u7ed3\u5c3e\u4e0a<a href=\"http:\/\/v.youku.com\/v_show\/id_XNzUzODA4Mzcy.html\">\u4e00\u6bb5\u8be5\u4f8b\u5b50\u5728\u79fb\u52a8\u7ec8\u7aef\u7684\u8fd0\u884c\u64cd\u4f5c\u89c6\u9891<\/a><br \/>\n<iframe loading=\"lazy\" src=\"http:\/\/player.youku.com\/embed\/XNzUzODA4Mzcy\" height=\"498\" width=\"510\" allowfullscreen=\"\" frameborder=\"0\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u7b80\u79f0<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u63d0\u4f9b\u4e86\u6db5\u76d6\u901a\u7528\u7ec4\u4ef6\u30012D\u62d3\u6251\u56fe\u5f62\u7ec4\u4ef6\u4ee5\u53ca3D\u5f15\u64ce\u7684\u4e00\u7ad9\u5f0f\u89e3\u51b3\u65b9\u6848\uff0c\u6b63\u5982<a href=\"http:\/\/www.hightopo.com\/\">Hightopo\u5b98\u7f51<\/a>\u6240\u8868\u8fbe\u7684\u6211\u4eec\u5e0c\u671b\u63d0\u4f9b\uff1aEverything you need to create cutting-edge 2D and 3D visualization. \u8fd9\u4e2a\u613f\u666f\u4ece\u529f\u80fd\u4e0a\u662f\u4e2a\u76f8\u5f53\u957f\u7684\u6218\u7ebf\uff0c\u4ece\u8bbe\u8ba1\u67b6\u6784\u4e0a\u4e5f\u662f\u6781\u5177\u6311\u6218\u6027\u7684\uff0c\u5176\u5b9e<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u56e2\u961f\u662f\u975e\u5e38\u4fdd\u5b88\u7684\uff0c\u6211\u4eec\u4ece\u4e0d\u8d2a\u591a\u56fe\u5927\uff0c\u53ea\u505a\u6211\u4eec\u611f\u89c9\u81ea\u5df1\u80fd\u5f97\u66f4\u597d\uff0c\u80fd\u7ed9\u7528\u6237\u7efc\u5408\u4f53\u9a8c\u66f4\u4f73\u7684\u529f\u80fd\uff0c\u5728\u8fd9\u6837\u7406\u5ff5\u9a71\u52a8\u4e0b\u6211\u4eec\u6162\u6162\u5f62\u6210\u4e86\u8fd9\u6837\u7684\u613f\u666f\uff0c\u6162\u6162\u5b9e\u73b0\u4e86\u51e0\u4e2a\u6709\u610f\u4e49\u7684\u91cc\u7a0b\u7891\uff0c\u6162\u6162\u79ef\u7d2f\u4e0b\u4e86\u4e0d\u5c11\u56fe\u5f62\u7ec4\u4ef6\u8bbe\u8ba1\u4e0a\u7684\u521b\u65b0\u548c\u7ecf\u9a8c\uff0c\u6211\u4e0d\u77e5\u9053\u8fd9\u4e2a\u7cfb\u5217\u4f1a\u5199\u591a\u5c11\u7bc7\uff0c\u4e5f\u8bb8\u6c38\u8fdc\u4e5f\u4e0d\u4f1a\u7ed3\u675f\uff0c\u4e5f\u6ca1\u6709\u7cfb\u7edf\u7684\u63d0\u7eb2\u89c4\u5212\uff0c\u60f3\u5230\u4ec0\u4e48\u5c31\u5199\u4ec0\u4e48\uff0c\u53ea\u5e0c\u671b\u6587\u7ae0\u80fd\u542f\u53d1\u6709\u5174\u8da3\u7684\u540c\u5b66\u5bf9\u56fe\u5f62\u7ec4\u4ef6\u8bbe\u8ba1\u66f4\u6df1\u7684\u601d\u8003\u5c31\u8db3\u591f\u4e86\u3002<\/p>\n<p>\u8ba8\u8bba\u524d\u5148\u8bbe\u5b9a\u8bdd\u9898\u7684\u8fb9\u754c\uff0c<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u662f\u57fa\u4e8eHTML5\u7684\u56fe\u5f62\u7ec4\u4ef6\u5e93\uff0c\u56e0\u6b64\u6587\u7ae0\u7684\u6848\u4f8b\u66f4\u591a\u4f1a\u6d89\u53caHTML\u548cJavaScript\u8bed\u8a00\uff0c\u4f46\u5e76\u4e0d\u5c40\u9650\u4e8eWeb\u524d\u7aef\uff0c\u8bbe\u8ba1\u601d\u60f3\u4e0a\u540c\u6837\u9002\u7528\u4e8e\u4efb\u4f55GUI\u8bed\u8a00\u5e73\u53f0\u3002\u5b8c\u6574\u7684\u524d\u7aef\u8bbe\u8ba1\u662f\u9700\u8981\u8003\u8651\u5230\u540e\u53f0\u52a0\u8f7d\u5e76\u53d1\u7b49\u56e0\u7d20\uff0c\u4f46\u672c\u7cfb\u5217\u66f4\u4fa7\u91cd\u4e8e\u7eaf\u5ba2\u6237\u7aef\u56fe\u5f62\u7ec4\u4ef6\uff0c\u4e0d\u6d89\u53ca\u7f51\u7edc\u901a\u8baf\u90e8\u5206\u7684\u601d\u8003\uff0c\u4f8b\u5982\u6700\u8fd1<a href=\"http:\/\/weibo.com\/p\/1001603741249222874725\">\u963f\u91cc\u65e0\u7ebf\u524d\u7aef\u62db\u8058<\/a>\u8ba9\u8c08\u8c08\uff1a\u8bb2\u8bb2\u8f93\u5165\u5b8c\u7f51\u5740\u6309\u4e0b\u56de\u8f66\uff0c\u5230\u770b\u5230\u7f51\u9875\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\u53d1\u751f\u4e86\u4ec0\u4e48\u3002\u8fd9\u662f\u4e2a\u80fd\u8ba8\u8bba\u51fa\u5f88\u591a\u65b9\u65b9\u9762\u9762\uff0c\u8ba9\u4f60\u4e86\u89e3\u9762\u8bd5\u8005\u7684\u597d\u8bdd\u9898\uff0c\u4f46\u8fd9\u91cc\u8ba8\u8bba\u7684\u8bdd\u9898\u4f1a\u4e0e\u4ee5\u4e0b\u5173\u952e\u5b57\u66f4\u4e3a\u76f8\u5173\uff1a\u4f01\u4e1a\u5e94\u7528\u3001Single Page Application\u3001\u91cd\u5ba2\u6237\u7aef\u4ea4\u4e92\u3001\u76d1\u63a7\u3001MV*\u7b49\u3002<\/p>\n<p>\u5982Linus\u5927\u795e\u6240\u8a00\uff1aTalk\u00a0is\u00a0cheap,\u00a0show\u00a0me\u00a0the\u00a0code.\u00a0 \u56e0\u6b64\u6211\u9009\u62e9\u5728\u8bdd\u9898\u5c55\u5f00\u4e4b\u524d\uff0c\u5148\u7528HT\u6765\u6269\u5c55\u5b9a\u5236\u51e0\u4e2a\u5e94\u7528\u6848\u4f8b\uff0c\u4ee5\u4fbf\u5927\u5bb6\u4e86\u89e3<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7ec4\u4ef6\u53ca\u5176\u6269\u5c55\u8bbe\u8ba1\u601d\u8def\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/1282039088303.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-190\" alt=\"1282039088303\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/1282039088303.jpg\" width=\"536\" height=\"334\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/1282039088303.jpg 536w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/1282039088303-300x186.jpg 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/1282039088303-200x124.jpg 200w\" sizes=\"(max-width: 536px) 100vw, 536px\" \/><\/a><\/p>\n<p>\u719f\u6089Flex\u7684\u7a0b\u5e8f\u5458\u5e94\u8be5\u90fd\u4e86\u89e3<a href=\"http:\/\/www.adobe.com\/devnet\/flex\/tourdeflex.html\">Tour de Flex<\/a>\u8fd9\u4e2a\u5305\u7f57\u4e07\u8c61\u7684\u5927\u6742\u70e9\uff0c\u5176\u4e2d\u7684\u7f51\u7edc\u76d1\u63a7\u62d3\u6251<a href=\"http:\/\/www.adobe.com\/devnet\/flex\/samples\/network_monitor.html\">Network Monitor<\/a>\u7279\u522b\u5176\u52a8\u753b\u5207\u6362\u6548\u679c\u4e00\u76f4\u7ed9\u6211\u5f88\u6df1\u5370\u8c61\uff0c\u8fd9\u91cc\u4e0d\u53ef\u80fd\u6709\u7bc7\u5e45\u5b9e\u73b0\u5b8c\u6574\u4f8b\u5b50\uff0c\u6211\u4eec\u4ec5\u5c1d\u8bd5\u5b9e\u73b0\u5176\u5c55\u793aCPU\u548cMEM\u7684\u754c\u9762\u90e8\u5206\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/IMG_3641.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-191\" alt=\"IMG_3641\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/IMG_3641.jpg\" width=\"664\" height=\"498\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/IMG_3641.jpg 664w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/IMG_3641-300x225.jpg 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/08\/IMG_3641-200x150.jpg 200w\" sizes=\"(max-width: 664px) 100vw, 664px\" \/><\/a><\/p>\n<p>\u5b9e\u73b0\u7684\u6700\u7ec8\u6548\u679c\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u6a21\u578b\u6570\u636e\u5c31\u4e24\u4e2a\u6570\u503c\uff0c\u4e00\u4e2a\u4ee3\u8868CPU\u5360\u7528\u7387\uff0c\u4e00\u4e2a\u4ee3\u8868\u5185\u5b58\u5360\u7528\u7387\uff0c\u5de6\u4fa7\u901a\u8fc7<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684\u56fe\u5f62\u7ec4\u4ef6GraphView\u81ea\u5b9a\u4e49\u4e86\u77e2\u91cf\u56fe\u5f62\u5c55\u793a\uff0c\u53f3\u4e0a\u89d2\u81ea\u5b9a\u4e49\u4e86\u5c5e\u6027\u9875PropertyView\u7684\u4e24\u5355\u5143\u683c\u7684Renderer\uff0c\u53f3\u4e0b\u89d2\u4e24\u4e2aSlider\u53ef\u62d6\u52a8\u6539\u53d8CPU\u548cMEN\u503c\u3002<\/p>\n<p>\u6b64\u4f8b\u5b50\u9ebb\u96c0\u867d\u5c0f\u4e94\u810f\u4ff1\u5168\uff0c\u4e09\u4e2a\u90e8\u5206\u5206\u522b\u91c7\u7528\u4e09\u79cd\u65b9\u5f0f\u5b9e\u73b0\u4e86\u81ea\u5b9a\u4e49\u7ec4\u4ef6\uff0c\u540c\u65f6\u4e0d\u540c\u7ec4\u4ef6\u5171\u4eab\u540c\u4e00\u6570\u636e\u6e90\uff0c\u5728\u5448\u73b0\u7684\u57fa\u7840\u4e0a\u8fd8\u652f\u6301\u684c\u9762\u548c\u79fb\u52a8\u7aef\u7684Mouse\u548cTouch\u7684\u4ea4\u4e92\uff0c\u8fd8\u6709\u4e0d\u540c\u7ec8\u7aef\u5c4f\u5e55\u7684\u7ec4\u4ef6\u5e03\u5c40\u529f\u80fd\u3002<\/p>\n<p>\u4e1a\u52a1\u4e0a\u9700\u8981\u5728\u5360\u7528\u7387\u5c0f\u4e8e40%\u65f6\u5448\u73b0\u5f8b\u5e08\uff0c40%-70%\u65f6\u663e\u793a\u9ec4\u8272\uff0c\u8d85\u8fc770%\u65f6\u5448\u73b0\u7ea2\u8272\uff0c\u56e0\u6b64\u5b9a\u4e49\u4e86\u5982\u4e0bgetColor\u7684\u5de5\u5177\u51fd\u6570\uff1a<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">\tgetColor = function(value) {\r\n\t\tif (value &lt; 40)\r\n\t\t\treturn '#00A406';\r\n\t\tif (value &lt; 70)\r\n\t\t\treturn '#FFCC00';\r\n\t\treturn '#A60000';\r\n\t};<\/pre>\n<p>PropertyView\u4e0a\u91c7\u7528\u7684\u6700\u57fa\u7840\u548c\u539f\u59cb\u7684\u65b9\u5f0f\uff0c\u901a\u8fc7Canvas\u753b\u7b14\u8fdb\u884c\u5355\u5143\u683c\u7684\u81ea\u5b9a\u4e49\u7ed8\u5236\uff0c\u5728\u6ce8\u518cPropertyView\u65f6\u91cd\u8f7ddrawPropertyValue\u51fd\u6570\u5373\u53ef\u5b9e\u73b0\u5355\u5143\u683c\u81ea\u5b9a\u4e49Renderer\u7684\u7ed8\u5236<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">drawFunc = function(g, value, x, y, w, h){\r\n\tg.fillStyle = '#A1A1A3';\r\n\tg.beginPath();\r\n\tg.rect(x, y, w, h);\r\n\tg.fill();                    \r\n\tg.fillStyle = getColor(value);\r\n\tg.beginPath();\r\n\tg.rect(x, y, w * value \/ 100, h);\r\n\tg.fill();\r\n\tht.Default.drawText(g, value + '%', '12px Arial', 'white', x, y, w, h, 'center'); \r\n};\r\npropertyView.addProperties([\r\n\t{\r\n\t\tdisplayName: 'CPU',\r\n\t\tdrawPropertyValue: function(g, property, value, rowIndex, x, y, w, h, data, view) \t{\r\n\t\t\tdrawFunc(g, data.a('cpu'), x, y, w, h);\r\n\t\t}\r\n\t},\r\n\t{\r\n\t\tdisplayName: 'MEM',\r\n\t\tdrawPropertyValue: function(g, property, value, rowIndex, x, y, w, h, data, view) {\r\n\t\t\tdrawFunc(g, data.a('mem'), x, y, w, h);\r\n\t\t}        \r\n\t}\r\n]);<\/pre>\n<p>Slider\u62c9\u6761\u90e8\u5206\u76f4\u63a5\u5728HT\u5c01\u88c5\u7684\u7ec4\u4ef6\u4e4b\u4e0a\u5e94\u7528\uff0c\u56e0\u800c\u65e0\u9700\u63a5\u89e6\u5230\u6700\u5e95\u5c42\u7684Canvas\u753b\u7b14\u7ed8\u5236\uff0c\u4ec5\u9700\u8981\u5728onValueChanged\u65f6\u66f4\u65b0leftBackgroud\u62c9\u6761\u5de6\u4fa7\u989c\u8272\u5373\u53ef\uff0c\u5176\u5b9e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u91cd\u8f7dSlider\u7684getLeftBackground\u51fd\u6570\u5b9e\u73b0\uff1a<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">formPane.addRow(['CPU', {\r\n\tslider: {\r\n\t\tstep: 1,\r\n\t\tonValueChanged: function(){\r\n\t\t\tvar value = this.getValue();\r\n\t\t\tnode.a('cpu', value);\r\n\t\t\tthis.setLeftBackground(getColor(value));\r\n\t\t},\r\n\t\tvalue: node.a('cpu')        \r\n\t}\r\n}], [50, 0.1]);\r\nformPane.addRow(['MEM', {\r\n\tslider: {\r\n\t\tstep: 1,                        \r\n\t\tonValueChanged: function(){\r\n\t\t\tvar value = this.getValue();\r\n\t\t\tnode.a('mem', value);\r\n\t\t\tthis.setLeftBackground(getColor(value));\r\n\t\t},\r\n\t\tvalue: node.a('mem')        \r\n\t}\r\n}], [50, 0.1]);<\/pre>\n<p>GraphView\u90e8\u5206\u91c7\u7528\u4e86\u300a<a href=\"http:\/\/www.hightopo.com\/blog\/175.html\">HT\u5168\u77e2\u91cf\u5316\u7684\u56fe\u5f62\u7ec4\u4ef6\u8bbe\u8ba1<\/a>\u300b\u6587\u7ae0\u4ecb\u7ecd\u7684HT\u81ea\u5b9a\u4e49\u7684\u77e2\u91cf\u65b9\u5f0f\u6765\u5b9e\u73b0\u56fe\u5f62\u6548\u679c\uff0c\u8fd9\u79cd\u65b9\u5f0f\u4ecb\u4e8e\u4ee5\u4e0a\u4e24\u79cd\u6269\u5c55\u65b9\u5f0f\u4e4b\u95f4\uff0c\u9700\u8981\u81ea\u5b9a\u4e49\u7ed8\u5236\u6548\u679c\uff0c\u4f46\u901a\u8fc7HT\u63d0\u4f9b\u7684\u77e2\u91cf\u683c\u5f0f\uff0c\u7528\u6237\u53ef\u91c7\u7528\u8f83\u4e3a\u76f4\u89c2\u6613\u8bfb\u7684JSON\u683c\u5f0f\u6765\u63cf\u8ff0\u56fe\u5f62\uff0c\u5e76\u901a\u8fc7\u6570\u636e\u7ed1\u5b9a\u7684\u65b9\u5f0f\u5b9e\u73b0\u6a21\u578b\u6570\u636e\u4e0e\u754c\u9762\u5448\u73b0\u7684\u5173\u8054\uff0c\u907f\u514d\u5982\u7b2c\u4e00\u79cd\u81ea\u5b9a\u4e49renderer\u7684\u65b9\u5f0f\uff0c\u5373\u9700\u8981\u63a5\u89e6\u5230\u5e95\u5c42\u7ed8\u5236\u51fd\u6570\uff0c\u540c\u65f6\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801\u4e0e\u7ed8\u5236\u4ee3\u7801\u6df7\u6742\u4e00\u8d77\u4e0d\u6613\u7ef4\u62a4\u7684\u95ee\u9898\u3002<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">ht.Default.setImage('server_image', {\r\n\twidth: 300,\r\n\theight: 200,\r\n\tcomps: [\r\n\t\t{\r\n\t\t\ttype: \"roundRect\",\r\n\t\t\trect: [3, 5, 291, 189],\r\n\t\t\tbackground: \"#E3E3E3\",\r\n\t\t\tgradient: \"linear.northeast\",\r\n\t\t\tshadow: true\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"text\",\r\n\t\t\ttext: \"CPU\",\r\n\t\t\tfont: \"16px Arial\",\r\n\t\t\trect: [20, 45, 59, 41]\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"text\",\r\n\t\t\ttext: \"MEM\",\r\n\t\t\tfont: \"16px Arial\",\r\n\t\t\trect: [20, 108, 59, 41]\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"rect\",\r\n\t\t\trect: [82, 55, 145, 22],\r\n\t\t\tbackground: \"#A1A1A3\"\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"rect\",\r\n\t\t\trect: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn [82, 55, 145 * data.a('cpu') \/ 100, 22];\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tbackground: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn getColor(data.a('cpu'));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"rect\",\r\n\t\t\trect: [82, 117, 145, 22],\r\n\t\t\tbackground: \"#A1A1A3\"\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"rect\",\r\n\t\t\trect: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn [82, 117, 145 * data.a('mem') \/ 100, 22];\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tbackground: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn getColor(data.a('mem'));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"text\",\r\n\t\t\tfont: \"16px Arial\",\r\n\t\t\trect: [240, 49, 53, 31],\r\n\t\t\ttext: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn data.a('cpu') + '%';\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tcolor: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn getColor(data.a('cpu'));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"text\",\r\n\t\t\tfont: \"16px Arial\",\r\n\t\t\trect: [240, 108, 47, 39],\r\n\t\t\ttext: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn data.a('mem') + '%';\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tcolor: {\r\n\t\t\t\tfunc: function(data) {\r\n\t\t\t\t\treturn getColor(data.a('mem'));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n});<\/pre>\n<p>\u4ee5\u4e0a\u4ee3\u7801\u6ce8\u518c\u4e86\u540d\u4e3aserver-image\u7684\u56fe\u7247\uff0c\u7ed1\u5b9a\u4e86attr\u4e0a\u7684mem\u548ccpu\u7684\u4e24\u4e2a\u5c5e\u6027\uff0c\u56e0\u6b64\u505a\u5b8c\u8fd9\u4e9b\u624b\u811a\u67b6\u7684\u57fa\u7840\u5de5\u4f5c\u540e\uff0c\u5e94\u7528\u4eba\u5458\u53ea\u9700\u8981\u6784\u5efaht.Node\u5bf9\u8c61\uff0c\u901a\u8fc7node.setImage(&#8216;server-image&#8217;)\u5373\u53ef\u5b9e\u73b0\u8be5\u56fe\u5143\u5728GraphView\u4e0a\u5448\u73b0&#8217;server-image&#8217;\u63cf\u8ff0\u7684\u77e2\u91cf\u6548\u679c\uff0c\u5e76\u4e14PropertyView\u3001Slider\u548cGraphView\u4e09\u4e2a\u7ec4\u4ef6\u90fd\u901a\u8fc7node\u7684attr\u4e0a\u7684cpu\u548cmem\u6765\u663e\u793a\u754c\u9762\uff0c\u8fd9\u6837\u5f53\u540e\u53f0\u83b7\u53d6\u5230\u91c7\u96c6\u7684\u5b9e\u65f6\u6570\u636e\u540e\uff0c\u53ea\u9700\u8981\u66f4\u65b0\u5230node\u7684attr\u4e0a\u7684cpu\u548cmem\u5c5e\u6027\uff0c\u5219\u754c\u9762\u4e0a\u7684\u6240\u6709\u7ec4\u4ef6\u5c31\u4f1a\u81ea\u5b9a\u66f4\u65b0\u663e\u793a\uff1a<\/p>\n<pre class=\"&quot;brush:javascript\u201d\">node = new ht.Node();\r\nnode.setName('SERVER');\r\nnode.setImage('server_image');\r\nnode.a({\r\n\tcpu: 30,\r\n\tmem: 70\r\n});\r\ndataModel.add(node);<\/pre>\n<p>\u5f53\u7136\u5b9e\u9645\u5e94\u7528\u4e2d\u5e76\u4e0d\u9700\u8981\u62c9\u6761\u6539\u53d8CPU\u548cMEN\u503c\uff0c\u8fd9\u4e9b\u503c\u4e00\u822c\u901a\u8fc7\u540e\u53f0\u91c7\u96c6\u5b9e\u65f6\u81ea\u52a8\u66f4\u65b0\u4ec5\u4f5c\u4e3a\u5448\u73b0\uff0c\u4f46\u6709\u4e86\u524d\u7aef\u8fd9\u4e9b\u7ec4\u4ef6\u7684\u4e00\u7ad9\u5f0f\u652f\u6301\uff0c\u6211\u4eec\u4e0d\u9700\u8981\u8fde\u63a5\u540e\u53f0\u4e5f\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5728\u5ba2\u6237\u7aef\u8fdb\u884c\u6a21\u62df\u6d4b\u8bd5\uff0c\u6709\u4e86\u8fd9\u6837\u7684\u673a\u5236\u6211\u4eec\u5c31\u53ef\u4ee5\u5206\u79bb\u6a21\u5757\u4e00\u6b65\u6b65\u6d4b\u8bd5\uff0c\u4f8b\u5982\u6211\u4eec\u73b0\u5728\u4e0d\u9700\u8981\u8fde\u63a5\u670d\u52a1\u5668\u4e5f\u53ef\u4ee5\u6d4b\u8bd5\u77e2\u91cf\u63cf\u8ff0\u5b9a\u4e49\u7684\u662f\u5426\u6b63\u786e\uff0c\u6570\u503c\u6539\u53d8\u540e\u7eff\u9ec4\u7ea2\u7684\u4e1a\u52a1\u989c\u8272\u66f4\u65b0\u662f\u5426\u6b63\u786e\uff0c\u5404\u4e2a\u7ec4\u4ef6\u7684\u6570\u636e\u540c\u6b65\u662f\u5426\u6b63\u5e38\uff0cMouse\u548cTouch\u4ea4\u4e92\u662f\u5426\u80fd\u6b63\u5e38\u64cd\u4f5c\uff0c\u754c\u9762\u5728\u4e0d\u540c\u8bbe\u5907\u5c4f\u5e55\u4e0a\u663e\u793a\u662f\u5426\u6b63\u5e38\u7b49\u7b49\uff0c\u8fd9\u4e9b\u7eaf\u5ba2\u6237\u7aef\u7ec4\u4ef6\u7684\u5c01\u88c5\u5de5\u4f5c\u90fd\u505a\u5230\u4f4d\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u5b89\u5fc3\u8fde\u63a5\u540e\u53f0\u6570\u636e\u8fdb\u884c\u6d4b\u8bd5\u4e86\u3002<\/p>\n<p>\u89c1\u8fc7\u592a\u591a\u5ba2\u6237\u51fa\u95ee\u9898\u65f6\u53ea\u4f1a\u8bf4\uff1a\u754c\u9762\u663e\u793a\u4e0d\u5bf9\u3002\u8fd9\u6837\u7684\u95ee\u9898\u63cf\u8ff0\u5b8c\u5168\u65e0\u6cd5\u5b9a\u4f4d\u6839\u6e90\uff0c\u5230\u5e95\u65f6\u540e\u53f0\u6570\u636e\u5e93\u95ee\u9898\uff0c\u7f51\u7edc\u901a\u8baf\u95ee\u9898\uff0c\u89e3\u6790\u6570\u636e\u95ee\u9898\uff0c\u8bbe\u7f6e\u6a21\u578b\u95ee\u9898\u8fd8\u662f\u7ec4\u4ef6\u5c01\u88c5\u95ee\u9898\uff1f\u8fd9\u4e5f\u662fMVC\/MVP\/MVVM\u5b58\u5728\u7684\u53e6\u5916\u4e00\u4e2a\u5c42\u9762\u7684\u610f\u4e49\uff0cMV*\u9664\u4e86\u4e8b\u4ef6\u6d3e\u53d1\u6570\u636e\u7ed1\u5b9a\u5916\uff0c\u80fd\u66f4\u597d\u7684\u8fdb\u884c\u5448\u73b0\u3001\u6a21\u578b\u548c\u4e1a\u52a1\u903b\u8f91\u7684\u5206\u5de5\u5207\u5272\u8fdb\u884c\u72ec\u7acb\u6d4b\u8bd5\u7684\u91cd\u8981\u610f\u4e49\uff0c\u5c31\u884cTCP\/IP\u4e03\u5c42\u534f\u8bae\u7684\u5206\u7c7b\uff0c\u6bcf\u4e2a\u534f\u8bae\u5c42\u90fd\u5e94\u8be5\u786e\u4fdd\u6b63\u786e\u5b9e\u73b0\u81ea\u5df1\u7684\u534f\u5b9a\u7ea6\u5b9a\uff0c\u5e76\u4e14\u6bcf\u4e00\u5c42\u53ef\u8fdb\u884c\u72ec\u7acb\u7684\u6d4b\u8bd5\uff0c\u8fd9\u624d\u662f\u53ef\u7ef4\u62a4\u53ef\u6269\u5c55\u7684\u7cfb\u7edf\uff0c\u56e0\u6b64\u5bf9\u4e8eHT\u5ba2\u6237\u9047\u5230\u95ee\u9898\u65f6\uff0c\u6211\u4eec\u4e00\u822c\u4e5f\u662f\u4e00\u5c42\u5c42\u7684\u5e2e\u5fd9\u68b3\u7406\u627e\u6839\u6e90\uff0c\u5982\u679c\u77e2\u91cf\u63cf\u8ff0\u6ca1\u95ee\u9898\u5448\u73b0\u51fa\u9519\uff0c\u90a3\u662fHT\u7ec4\u4ef6\u5e93\u7684\u95ee\u9898\uff0c\u5982\u679c\u6a21\u62df\u5230Node\u4e0a\u7684attr\u6570\u636e\u663e\u793a\u6b63\u786e\uff0c\u90a3\u5c31\u53bb\u627e\u627e\u5b9e\u9645\u8fd0\u884c\u540e\u53f0\u901a\u4fe1\u89e3\u6790\u540e\u7684\u6570\u636e\u662f\u5426\u6b63\u786e\u7684\u8bbe\u7f6e\u5230\u6a21\u578b\u4e0a\uff0c\u8fd9\u6837\u4e00\u6b65\u6b65\u7684\u5206\u6790\u5f88\u5bb9\u6613\u5c31\u80fd\u5b9a\u4f4d\u5230\u95ee\u9898\u7684\u6839\u6e90\u3002<\/p>\n<p>\u4ee5\u4e0a\u4e09\u79cd\u6269\u5c55\u65b9\u5f0f\u5404\u6709\u5229\u5f0a\uff0c\u6211\u5c06\u5728\u4e0b\u7bc7\u4e2d\u7ee7\u7eed\u5c55\u5f00\u5206\u6790\uff0c\u672c\u7bc7\u7ed3\u5c3e\u4e0a<a href=\"http:\/\/v.youku.com\/v_show\/id_XNzUzODA4Mzcy.html\">\u4e00\u6bb5\u8be5\u4f8b\u5b50\u5728\u79fb\u52a8\u7ec8\u7aef\u7684\u8fd0\u884c\u64cd\u4f5c\u89c6\u9891<\/a><br \/>\n<iframe loading=\"lazy\" src=\"http:\/\/player.youku.com\/embed\/XNzUzODA4Mzcy\" height=\"498\" width=\"510\" allowfullscreen=\"\" frameborder=\"0\"><\/iframe><\/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\/189"}],"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=189"}],"version-history":[{"count":1,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/189\/revisions"}],"predecessor-version":[{"id":192,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/189\/revisions\/192"}],"wp:attachment":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/media?parent=189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/categories?post=189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/tags?post=189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}