{"id":889,"date":"2014-04-09T16:42:44","date_gmt":"2014-04-09T08:42:44","guid":{"rendered":"http:\/\/www.storagelab.org.cn\/zhangdi\/?p=889"},"modified":"2014-04-09T16:42:44","modified_gmt":"2014-04-09T08:42:44","slug":"%e7%99%be%e5%ba%a6%e6%95%b0%e6%8d%ae%e5%8f%af%e8%a7%86%e5%8c%96%e5%9b%be%e8%a1%a8%e5%a5%97%e4%bb%b6echart%e5%ae%9e%e6%88%98","status":"publish","type":"post","link":"https:\/\/www.divis.cn\/index.php\/2014\/04\/09\/%e7%99%be%e5%ba%a6%e6%95%b0%e6%8d%ae%e5%8f%af%e8%a7%86%e5%8c%96%e5%9b%be%e8%a1%a8%e5%a5%97%e4%bb%b6echart%e5%ae%9e%e6%88%98\/","title":{"rendered":"\u767e\u5ea6\u6570\u636e\u53ef\u89c6\u5316\u56fe\u8868\u5957\u4ef6echart\u5b9e\u6218"},"content":{"rendered":"<p>\u6700\u8fd1\u6211\u4e00\u76f4\u5728\u505a\u6570\u636e\u53ef\u89c6\u5316\u7684\u524d\u7aef\u5de5\u4f5c\uff0c\u6211\u7528\u7684\u6700\u591a\u7684\u7ed8\u56fe\u5de5\u5177\u662fd3\u3002d3\u6709\u70b9\u50cfphotoshop\uff0c\u529f\u80fd\u5f88\u5f3a\u5927\uff0c\u4f8b\u5b50\u4e5f\u5f88\u591a\uff0c\u4f46\u662f\u5b66\u4e60\u6210\u672c\u4e5f\u4e0d\u4f4e\uff0c\u505a\u9879\u76ee\u662f\u9700\u8981\u8f83\u5927\u4eba\u529b\u6295\u5165\u7684\u30023\u6708\u5e95\u7531\u5728\u4e9a\u9a6c\u900a\u5de5\u4f5c\u7684\u540c\u5b66\u4ecb\u7ecd\u4e0b\u4f7f\u7528\u4e86\u4e00\u4e0bechart\uff0c\u4e00\u4e2a\u7531\u767e\u5ea6\u524d\u7aef\u53d1\u8d77\u7684canvas\u56fd\u4ea7\u7c7b\u5e93\uff08\u5b98\u7f51\uff1a<a href=\"http:\/\/echarts.baidu.com\/index.html\">http:\/\/echarts.baidu.com\/index.html<\/a>\uff09\u3002\u8fd9\u4e2aechart\u5176\u5b9e\u662f\u5728canvas\u7c7b\u5e93zrender\u7684\u57fa\u7840\u4e0a\u505a\u7684\u4e3b\u9898\u56fe\u5e93\uff0c\u4f18\u70b9\u6709\u6570\u636e\u9a71\u52a8\uff0c\u56fe\u4f8b\u4e30\u5bcc\uff0c\u529f\u80fd\u5f3a\u5927\uff0c\u652f\u6301\u6570\u636e\u62d6\u62fd\u91cd\u8ba1\u7b97\uff0c\u6570\u636e\u533a\u57df\u6f2b\u6e38\uff0c\u5168\u4e2d\u6587\u6587\u6863\u975e\u5e38\u8fc7\u763e\u3002\u8ddf\u540c\u6837\u662f\u56fd\u4ea7\u7684\u524d\u7aef\u811a\u624b\u67b6fis\u4e00\u6837\uff08\u5b98\u7f51<a href=\"http:\/\/fis.baidu.com\/\">http:\/\/fis.baidu.com\/<\/a>\uff09\uff0c\u90fd\u662f\u8bda\u610f\u6ee1\u6ee1\u7684\u56fd\u4ea7\u5957\u9910\uff0c\u4f53\u73b0\u4e86\u73b0\u4eca\u56fd\u5185\u4e0d\u4fd7\u7684\u524d\u7aef\u5f00\u53d1\u5b9e\u529b\u3002\u4f7f\u7528\u5b83\u4eec\u7684\u611f\u89c9\u5c31\u50cf\u60f3\u81ea\u5df1\u505a\u4e2a\u5e73\u677f\u7535\u8111\uff0c\u53bb\u534e\u5f3a\u5317\u4e00\u8f6c\uff0c\u4e3b\u677f\u3001CPU\u3001\u5c4f\u5e55\u7b49\u5404\u79cd\u5957\u9910\u4e00\u8ba2\u8d2d\uff0c\u4e1c\u897f\u5c31\u54d7\u54d7\u5730\u7ec4\u88c5\u8d77\u6765\u4e86\u3002\u6781\u5176\u9ad8\u6548\uff0c\u975e\u5e38\u9002\u5408\u5546\u4e1a\u9879\u76ee\u5f00\u53d1\u3002\u800c\u4e14\uff0c\u5373\u4f7f\u662f\u4e3a\u4e86\u7814\u7a76\uff0c\u7528\u8fd9\u4e9b\u4e5f\u53ef\u4ee5\u6253\u4e00\u4e2a\u5f88\u597d\u7684\u57fa\u7840\u3002<\/p>\n<figure style=\"width: 759px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/echarts.baidu.com\/doc\/asset\/img\/architecture.png\" alt=\"\" width=\"759\" height=\"195\" \/><figcaption class=\"wp-caption-text\">Echart\u56fe\u8868\u5e93\u5c42\u6b21\u5173\u7cfb<\/figcaption><\/figure>\n<h3>1.\u5f15\u5165\u76ee\u5f55<\/h3>\n<p>\u5e9f\u8bdd\u4e0d\u591a\u8bf4\u4e86\uff0c\u770b\u5230\u597d\u4e1c\u897f\uff0c\u7b2c\u4e00\u6b65\u662f\u4ecegithub\u4e0a\u628a\u76f8\u5173\u6587\u4ef6\u5168\u4e0b\u4e0b\u6765\uff0c\u7136\u540e\u5230build\u76ee\u5f55\u7ffb\u7bb1\u5012\u67dc\u628a\u4e1c\u897f\u627e\u9f50\u3002\u65b0\u5efa\u76ee\u5f55\u5982\u4e0b\uff1a<\/p>\n<p>echarts-1.3.8<br \/>\n&#8212;-zrender \u00a0 \/\/zrender\u662fechart\u4f9d\u8d56\u7684\u7ed8\u56fe\u5e93\uff0c\u5b98\u7f51\u8981\u6c42\u4e0b\u8f7d\uff0c\u4f46\u662f\u76ee\u524d\u6211\u7684\u7a0b\u5e8f\u4e2d\u5e76\u6ca1\u6709\u76f4\u63a5\u5f15\u7528\u5b83\uff0c\u53ef\u4ee5\u8bf4\u666e\u901a\u60c5\u51b5\u4e0bechart\u53ef\u4ee5\u81ea\u5df1\u72ec\u7acb\u8fd0\u884c<br \/>\n&#8212;&#8212;&#8211;zrender.js<br \/>\n&#8212;-excanvas_r3 \/\/excanvas\u662f\u5b9e\u73b0IE7\uff0c8\u517c\u5bb9canvas\u7ed8\u56fe\u7684\u5229\u5668\uff0c\u5b9e\u73b0\u4e86\u5927\u90e8\u5206canvas\u7684API\uff0c\u5728\u7ed8\u56fe\u65b9\u9762\u5176\u6838\u5fc3\u662f\u901a\u8fc7IE\u7684VML\u53bb\u5b9e\u73b0\u7684\uff0c\u6548\u7387\u8f83\u4f4e<br \/>\n&#8212;&#8212;&#8211;excanvas.js<br \/>\n&#8212;-echarts.js \u00a0\/\/echarts\u4e3b\u7a0b\u5e8f\uff0c\u5305\u542b\u9664map\u4ee5\u5916\u6240\u6709\u7684\u4e3b\u9898\u56fe\u5e93\u3002\u6ce8\u610f\u8fd9\u4e2a\u662f\u538b\u7f29\u8fc7\u7684\uff0c\u5e76\u4e14\u53ea\u80fd\u901a\u8fc7requirejs\u6216\u8005esl.js\u6a21\u5757\u5316\u52a0\u8f7d\uff1b\u60f3\u7528\u6807\u7b7e\u6216sea.js\u52a0\u8f7d\u8bf7\u7528echarts-plain.js<br \/>\n&#8212;-echarts-orginal.js \u00a0\/\/\u6ca1\u6709\u538b\u7f29\u8fc7\u7684echarts.js<br \/>\n&#8212;-echarts-map.js \u00a0\/\/echarts\u7684map\u4e3b\u9898\u56fe\u5e93<\/p>\n<p>&nbsp;<\/p>\n<h3>2.\u5728\u81ea\u5df1\u7684\u9879\u76ee\u4e2d\u5b9e\u73b0\u5176demo<\/h3>\n<p>\u8fd9\u4e2aechart\u662f\u767e\u5ea6\u524d\u7aef\u505a\u7684\uff0c\u4ed6\u4eec\u63a8\u8350\u4f7f\u7528\u6a21\u5757\u5f0f\u5f00\u53d1\u3002\u597d\u5728\u6211\u4e4b\u524d\u7684\u9879\u76ee\uff0c\u5c31\u662f\u91c7\u7528requirejs + angularjs\u5f00\u53d1\u7684\u3002\u6240\u4ee5\u5f15\u5165\u6bd4\u8f83\u5bb9\u6613\u3002<\/p>\n<p>\u9996\u5148\uff0c\u5728requirejs\u7684\u5165\u53e3\u914d\u7f6e\u6587\u4ef6main.js\u91cc\u52a0\u4e0aechart:<\/p>\n<pre class=\"height-set:true width-set:true lang:default decode:true\">require.config({\n\n    baseUrl:'application\/views\/frontEnd\/build\/'\n    ,paths:{\n        \/\/\u8fd9\u91cc\u7701\u7565\u82e5\u5e72\u914d\u7f6e\u4fe1\u606f...\n        \/\/echart\u53ca\u5176\u7ec4\u4ef6\n        ,echarts: 'lib\/echarts-1.3.8\/echarts'\n        ,\"echarts\/chart\/line\": 'lib\/echarts-1.3.8\/echarts'\n        ,\"echarts\/chart\/bar\": 'lib\/echarts-1.3.8\/echarts'\n        ,'echarts\/chart\/scatter': 'lib\/echarts-1.3.8\/echarts'\n        ,'echarts\/chart\/k': 'lib\/echarts-1.3.8\/echarts'\n        ,'echarts\/chart\/pie': 'lib\/echarts-1.3.8\/echarts'\n        ,'echarts\/chart\/radar': 'lib\/echarts-1.3.8\/echarts'\n        ,'echarts\/chart\/map': 'lib\/echarts-1.3.8\/echarts'\n        ,'echarts\/chart\/chord': 'lib\/echarts-1.3.8\/echarts'\n        ,'echarts\/chart\/force': 'lib\/echarts-1.3.8\/echarts'\n        ,zrender: 'lib\/echarts-1.3.8\/zrender\/zrender'\n    }\n    ,priority:[\n        'angular'\n    ]\n    \/\/,urlArgs:'v=1.1'\n});<\/pre>\n<p>\u7136\u540e\uff0c\u5728\u8981\u5f15\u5165echart\u7684\u5177\u4f53\u9875\u9762\u63a7\u5236js\u6587\u4ef6\u91cc\uff0c\u52a0\u8f7d\u76f8\u5173\u4f9d\u8d56\u3002<\/p>\n<pre class=\"height-set:true lang:default decode:true\">define([\n\t    'echarts',\n\t    'echarts\/chart\/pie',\n\t    'd3'\n    ], function (ec) {\n\n    \tfunction common_chart_staff_assess_ctrl($http, $scope) {\n        \/\/ angularjs\u7684\u63a7\u5236\u5668....\n        }\n    }\n    return common_chart_staff_assess_ctrl;\n});<\/pre>\n<p>\u4ee5\u4e0a\u4e24\u6b65\uff0c\u719f\u6089dojo\u6216\u8005requirejs\u7684\u670b\u53cb\u5e94\u8be5\u90fd\u6beb\u65e0\u538b\u529b\uff0c\u4f46\u662f\u8fd8\u662f\u6709\u5f88\u591a\u670b\u53cb\u6ca1\u7528\u8fc7\u8fd9\u4e9b\uff0c\u6240\u4ee5\u8fd8\u662f\u6709\u5fc5\u8981\u8bf4\u4e00\u4e0b\u7684\u3002<\/p>\n<p>\u63a5\u7740\u5c31\u662f\u628a\u5b98\u7f51\u7684\u4f8b\u5b50\u653e\u5728\u81ea\u5df1\u7684\u9875\u9762\u91cc\u5b9e\u73b0\u3002\u8fd9\u91cc\u6211\u9009\u53d6\u4e86\u4e00\u4e2a\u7279\u522b\u7684\u5343\u5c42\u997c\u56fe\uff0c\u70b9\u51fb<a href=\"http:\/\/echarts.baidu.com\/doc\/example\/lasagna.html\">\u8fd9\u91cc<\/a>\u53bb\u5b98\u7f51\u67e5\u770b\u539f\u56fe\u3002<\/p>\n<p>\u90a3\u4e48\u6211\u4eec\u628a\u4f8b\u5b50\u91cc\u7684\u9759\u6001\u6570\u636e\uff08option\u5bf9\u8c61\uff09\u642c\u8fd0\u5230\u6211\u4eec\u81ea\u5df1\u7684JS\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u4eff\u7167\u5b98\u7f51\u7684\u4f8b\u5b50\u5199\u4e00\u4e2a\u6e32\u67d3&amp;\u5237\u65b0\u51fd\u6570<\/p>\n<pre class=\"height-set:true width-set:true lang:default decode:true\">\/\/\u6e32\u67d3&amp;\u5237\u65b0\u51fd\u6570\n\t\t\t$scope.refresh = function(option,isBtnRefresh){\n\t\t\t    if (isBtnRefresh) {\n\t\t\t        needRefresh = true;\n\t\t\t        if (needRefresh) {\n\t\t\t\t        myChart.showLoading();\n\t\t\t\t        setTimeout($scope.refresh(option), 500);\n\t\t\t\t    }\n\t\t\t        return;\n\t\t\t    }\n\t\t\t    needRefresh = false;\n\t\t\t    if (myChart &amp;&amp; myChart.dispose) {\n\t\t\t        myChart.dispose();\n\t\t\t    }\n\t\t\t    myChart = ec.init(domMain);\n\t\t\t    window.onresize = myChart.resize;\n\t\t\t    myChart.setOption(option, true);\n\t\t\t    domMessage.innerHTML = '';\n\t\t\t};\n\n\/\/\u6d4b\u8bd5\u6570\u636e\n$scope.option = {\n    title : {\n        text: '\u6d4f\u89c8\u5668\u5360\u6bd4\u53d8\u5316',\n        subtext: '\u7eaf\u5c5e\u865a\u6784',\n        x:'right',\n        y:'bottom'\n    },\n    tooltip : {\n        trigger: 'item',\n        formatter: \"{a} &lt;br\/&gt;{b} : {c} ({d}%)\"\n    },\n    legend: {\n        orient : 'vertical',\n        x : 'left',\n        data:['Chrome','Firefox','Safari','IE9+','IE8-']\n    },\n    toolbox: {\n        show : true,\n        feature : {\n            mark : {show: true},\n            dataView : {show: true, readOnly: false},\n            restore : {show: true},\n            saveAsImage : {show: true}\n        }\n    },\n    calculable : false,\n    series : (function(){\n        var series = [];\n        for (var i = 0; i &lt; 30; i++) {\n            series.push({\n                name:'\u6d4f\u89c8\u5668\uff08\u6570\u636e\u7eaf\u5c5e\u865a\u6784\uff09',\n                type:'pie',\n                itemStyle : {normal : {\n                    label : {show : i &gt; 28},\n                    labelLine : {show : i &gt; 28, length:20}\n                }},\n                radius : [i * 4 + 40, i * 4 + 43],\n                data:[\n                    {value: i * 128 + 80,  name:'Chrome'},\n                    {value: i * 64  + 160,  name:'Firefox'},\n                    {value: i * 32  + 320,  name:'Safari'},\n                    {value: i * 16  + 640,  name:'IE9+'},\n                    {value: i * 8  + 1280, name:'IE8-'}\n                ]\n            })\n        }\n        series[0].markPoint = {\n            symbol:'emptyCircle',\n            symbolSize:series[0].radius[0],\n            effect:{show:true,scaleSize:12,color:'rgba(250,225,50,0.8)',shadowBlur:10,period:30},\n            data:[{x:'50%',y:'50%'}]\n        };\n        return series;\n    })()\n};\nsetTimeout(function(){\n    var _ZR = myChart.getZrender();\n    \/\/ \u8865\u5145\u5343\u5c42\u997c\n    _ZR.addShape({\n        shape : 'text',\n        style : {\n            x : _ZR.getWidth() \/ 2,\n            y : _ZR.getHeight() \/ 2,\n            color: '#666',\n            text : '\u6076\u68a6\u7684\u8fc7\u53bb',\n            textAlign : 'center'\n        }\n    });\n    _ZR.addShape({\n        shape : 'text',\n        style : {\n            x : _ZR.getWidth() \/ 2 + 200,\n            y : _ZR.getHeight() \/ 2,\n            brushType:'fill',\n            color: 'orange',\n            text : '\u7f8e\u597d\u7684\u672a\u6765',\n            textAlign : 'left',\n            textFont:'normal 20px \u5fae\u8f6f\u96c5\u9ed1'\n        }\n    });\n    _ZR.refresh();\n}, 2000);<\/pre>\n<p>\u7136\u540e\u5728\u9875\u9762\u4e0a\u627e\u4e2adiv\uff0c\u663e\u793aechart\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u4e0d\u8fc7\u8bf7\u6ce8\u610f\u4e00\u5b9a\u8981\u7ed9\u8fd9\u4e2adiv\u8bbe\u7f6e\u5bbd\u5ea6\u9ad8\u5ea6\uff0c\u5426\u5219\u56fe\u663e\u793a\u4e0d\u51fa\u6765\u4e0d\u8981\u602a\u6211\u3002<\/p>\n<pre class=\"lang:default decode:true\">&lt;section class=\"span12\"&gt;     \n    &lt;div id=\"graph\" class=\"graph chart-area\" style=\"height:500px\"&gt;&lt;\/div&gt;\n&lt;\/section&gt;<\/pre>\n<p>\u6211\u8fd9\u91cc\u7528\u4e86bootstrap\uff0c\u5bbd\u5ea6\u662f\u6309\u6805\u683c\u7cfb\u7edf\u7684\u767e\u5206\u6bd4\u503c\u53d8\u5316\u7684\uff0c\u6240\u4ee5\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\u6ca1\u6709\u6307\u5b9a\u5bbd\u5ea6\u3002\u6700\u540e\u8c03\u8bd5\u8c03\u8bd5\uff0c\u6ca1\u6709\u95ee\u9898\u6211\u8fd9\u91cc\u4e5f\u53ef\u4ee5\u663e\u793a\u3002<\/p>\n<h3>3.\u5b9a\u5236<\/h3>\n<p>\u5f53\u7136\uff0c\u4ec5\u4ec5\u505c\u7559\u5728\u5f15\u7528\u522b\u4eba\u7684\u4f8b\u5b50\u662f\u4e0d\u80fd\u8ba9\u6211\u6ee1\u610f\u7684\u3002<\/p>\n<p>\u9996\u5148\uff0c\u8981\u8fdb\u884c\u6570\u636e\u7ed1\u5b9a\u3002<\/p>\n<p>\u8fd9\u91cc\u7ec6\u5206\u4e3a3\u6b65\uff1a<\/p>\n<ol>\n<li>\u5206\u6790\u6570\u636e\u683c\u5f0f\uff08\u5c31\u662f\u5206\u6790option\u5bf9\u8c61\uff0c\u8fd9\u4e00\u6b65\u9700\u8981\u6ce8\u610f\u628a\u540e\u53f0\u83b7\u53d6\u7684\u6570\u636e\u548c\u6837\u5f0f\u4fe1\u606f\u5206\u5f00\u3002\u6545\u800c\u6211\u5728\u4ee3\u7801\u91cc\u8bbe\u7f6e\u4e86$scope.option\u5bf9\u8c61\u5b58\u50a8\u9ed8\u8ba4\u7684\u6837\u5f0f\u914d\u7f6e\u4fe1\u606f\uff0c\u4e4b\u540eajax\u83b7\u53d6\u6570\u636e\u540e\u5c06\u4e8c\u8005\u518dextend\u5373\u53ef\u3002\uff09<\/li>\n<li>\u5728\u540e\u53f0\u7ec4\u88c5\u76f8\u5e94\u7684\u6570\u636e\uff08\u6839\u636e\u4e0d\u540c\u9700\u6c42\u800c\u5f02\uff0c\u6211\u8fd9\u91cc\u53ea\u53d6\u6570\u503c\u4fe1\u606f\uff0c\u4e0d\u591a\u8a00\uff09<\/li>\n<li>\u524d\u53f0ajax\u83b7\u53d6\u771f\u5b9e\u6570\u636e\uff08\u8fd9\u4e00\u70b9\u76f8\u4fe1\u5927\u5bb6\u90fd\u5f88\u7eaf\u719f\uff0c\u4e0d\u8fc7\u6211\u7684\u4ee3\u7801\u91cc\u662f\u4f7f\u7528angularjs\u5c01\u88c5\u8fc7\u7684$.post\u5bf9\u8c61\u6765\u505a\u5230\u8fd9\u4e00\u70b9\u7684\uff09<\/li>\n<\/ol>\n<pre class=\"height-set:true width-set:true lang:default decode:true\">\/\/\u8bbe\u7f6e\u771f\u5b9e\u6570\u636e\u683c\u5f0f\n$scope.default_option = {\n    title : {\n        text: '\u6545\u969c\u7c7b\u578b\u65f6\u5e8f\u53d8\u5316\u5e74\u8f6e\u56fe',\n        subtext: '\u672c\u56fe\u7531\u5185\u5411\u5916\u5c55\u793a\u4e86\u5404\u79cd\u6545\u969c\u7c7b\u578b\u7684\u51fa\u73b0\u9891\u7387\u6240\u5360\u767e\u5206\u6bd4\uff0c\u53ca\u5176\u968f\u65f6\u95f4\u53d8\u5316\u7684\u89c4\u5f8b',\n        x:'right',\n        y:'bottom'\n    },\n    tooltip : {\n        trigger: 'item',\n        formatter: \"{a} &lt;br\/&gt;{b} : {c} ({d}%)\"\n    },\n    legend: {\n        orient : 'vertical',\n        x : 'left',\n        selected: $scope.faultnameSelected\n        ,data:$scope.faultname\n    },\n    toolbox: {\n        show : true,\n        feature : {\n            mark : true,\n            dataView : {readOnly: false},\n            restore : true,\n            saveAsImage : true\n        }\n    },\n    calculable : false,\n    series : {}\n};\n\n $scope.ajaxChartData = function(dataname){ \n    myChart.showLoading({\n\t\ttext: '\u6b63\u5728\u52aa\u529b\u7684\u8bfb\u53d6\u6570\u636e\u4e2d...',    \/\/loading\u8bdd\u672f\n\t});  \n\t$http.post(\"index.php\/main\/readfaultnum\", null).success(function(alldata){\n\t\tconsole.log(alldata);\n\t\tvar option = $scope.default_option;\n\t\toption.series = $scope.setData(alldata);\n\t\t$scope.refresh(option,true);\n\t\t$scope.order = dataname;\n\n\t\tmyChart.hideLoading();\t\n\n\t}).error(function(){\n\t\tdomMessage.innerHTML = '\u7f51\u7edc\u6545\u969c\uff0c\u83b7\u53d6\u6570\u636e\u5931\u8d25';\n\t});\n };<\/pre>\n<p>\u8fd9\u6837\uff0c\u6211\u4eec\u5c31\u5c06\u5b98\u7f51\u7684\u5343\u5c42\u997c\u56fe\u53d8\u6210\u4e86\u7b26\u5408\u6211\u9879\u76ee\u9700\u8981\u7684\u5185\u5bb9\u2014\u2014\u6545\u969c\u7c7b\u578b\u65f6\u5e8f\u53d8\u5316\u5e74\u8f6e\u56fe\u3002\u6b64\u56fe\u53ef\u4ee5\u672c\u56fe\u7531\u5185\u5411\u5916\u5c55\u793a\u4e86\u5404\u79cd\u6545\u969c\u7c7b\u578b\u7684\u51fa\u73b0\u9891\u7387\u6240\u5360\u767e\u5206\u6bd4\uff0c\u53ca\u5176\u968f\u65f6\u95f4\u53d8\u5316\u7684\u89c4\u5f8b\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/i587.photobucket.com\/albums\/ss314\/zhangdiwaa\/my%20blog%20photo\/6545969C7C7B578B65F65E8F53D853165E748F6E56FE.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large\" src=\"http:\/\/oysa7b8qz.bkt.clouddn.com\/6545969C7C7B578B65F65E8F53D853165E748F6E56FE.png\" width=\"918\" height=\"500\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>5.\u8fdb\u4e00\u6b65\u5b9a\u5236<\/p>\n<p>\u867d\u7136\u6211\u4f7f\u7528\u4e86\u5b98\u7f51\u7684\u4f8b\u5b50\u5b9e\u73b0\u4e86\u9700\u6c42\uff0c\u4f46\u662f\u6211\u8fd8\u6709\u4e9b\u81ea\u5df1\u7684\u60f3\u6cd5\u3002<\/p>\n<p>\u5b98\u7f51\u7684\u5343\u5c42\u997c\u56fe\u4e2d\uff0c\u4ee3\u8868\u65f6\u95f4\u7684\u5e74\u8f6e\u5bbd\u5ea6\u662f\u56fa\u5b9a\u7684\u3002\u4f46\u662f\u6211\u4eec\u4ece\u540e\u53f0\u8bfb\u53d6\u7684\u6570\u636e\uff08\u4ee5\u6708\u4e3a\u9897\u7c92\u5ea6\uff09\u5728\u65f6\u95f4\u4e0a\u662f\u53d8\u5316\u7684\uff0c\u968f\u7740\u7cfb\u7edf\u4f7f\u7528\u65f6\u95f4\u589e\u957f\u800c\u589e\u957f\u3002\u8fd9\u5c31\u5bfc\u81f4\u4e00\u4e2a\u95ee\u9898\uff0c\u5c31\u662f\u5728\u53ea\u6709\u4e00\u4e2a\u6708\u65f6\uff0c\u5e74\u8f6e\u53ea\u6709\u5c0f\u5c0f\u4e00\u4e2a\uff0c\u670950\u4e2a\u6708\u65f6\uff0c\u5e74\u8f6e\u591a\u5230\u8d85\u8fc7\u4e86\u663e\u793a\u8303\u56f4\u3002\u8fd9\u6837\u5f88\u4e0d\u7f8e\u89c2\uff0c\u5e76\u4e14\u4e27\u5931\u4e86\u4e00\u5b9a\u7684\u53ef\u7528\u6027\u3002<\/p>\n<p><strong>\u6211\u51b3\u5b9a\u8981\u5bf9\u5176\u8fdb\u884c\u4f18\u5316\u3002\u5f53\u4f7f\u7528\u6708\u4efd\u5f88\u5c11\u6570\u636e\u5f88\u5c11\u7684\u65f6\u5019\uff0c\u5e74\u8f6e\u4f1a\u5f88\u5bbd\uff1b\u5f53\u4f7f\u7528\u6708\u4efd\u5f88\u5c11\u6570\u636e\u5f88\u5c11\u7684\u65f6\u5019\uff0c\u5e74\u8f6e\u4f1a\u5f88\u7ec6<\/strong>\u2014\u2014\u8fd9\u6837\u5c31\u53ef\u4ee5\u540c\u65f6\u907f\u514d\u6570\u636e\u91cf\u5c0f\u7684\u65f6\u5019\u4e0d\u7f8e\u89c2\u548c\u6570\u636e\u91cf\u5927\u7684\u65f6\u5019\u4e27\u5931\u53ef\u7528\u6027\u7684\u95ee\u9898\u4e86\u3002\u5f53\u7136\uff0c\u5982\u679c\u6570\u636e\u91cf\u8fc7\u5927\uff0c\u5e74\u8f6e\u5c31\u4f1a\u8fc7\u7ec6\uff0c\u540c\u6837\u4f1a\u4e27\u5931\u53ef\u7528\u6027\u3002\u56e0\u6b64\u6211\u4eec\u8981\u8bbe\u7f6e\u4e00\u4e2a\u6700\u5927\u6570\u636e\u91cf\u7684\u9608\u503c\uff0c\u628a\u8d85\u8fc7\u7684\u90e8\u5206\u780d\u6389\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\u5c31\u662f\u8981\u5bf9\u6839\u636e\u6570\u636e\u91cf\u5bf9\u5e74\u8f6e\u5bbd\u5ea6\u8fdb\u884c\u7f29\u653e\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528\u6bd4\u4f8b\u5c3a\u51fd\u6570\u3002\u5728echart\u91cc\u6211\u6682\u65f6\u6ca1\u6709\u627e\u5230\u8fd9\u6837\u7684\u6bd4\u4f8b\u5c3a\u51fd\u6570\u3002\u5f53\u7136\uff0c\u7ebf\u6027\u6bd4\u4f8b\u5c3a\u5f88\u7b80\u5355\uff0c\u51fd\u6570\u53ef\u4ee5\u81ea\u5df1\u5199\u3002\u4f46\u662f\u5176\u4ed6\u7c7b\u578b\u7684\u6bd4\u4f8b\u5c3a\u7f29\u653e\u5c31\u7a0d\u5fae\u8981\u4e00\u4e9b\u6280\u5de7\u4e86\u3002\u597d\u5728\u4e4b\u524d\u6211\u4e00\u76f4\u662f\u4f7f\u7528d3\u7c7b\u5e93\u6765\u505a\u53ef\u89c6\u5316\u7684\uff0c\u6211\u77e5\u9053d3\u91cc\u6709\u8fd9\u6837\u7684\u6bd4\u4f8b\u5c3a\u51fd\u6570\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u89e3\u51b3\u6211\u7684\u95ee\u9898\u3002\u90a3\u5c31\u662fd3.scale\u5bf9\u8c61\uff0c\u5176\u4e2d\u5305\u542b\u7ebf\u6027\u6bd4\u4f8b\u5c3a\u3001\u5e73\u65b9\u6bd4\u4f8b\u5c3a\u3001\u6307\u6570\u6bd4\u4f8b\u5c3a\u3001\u96c6\u5408\u6bd4\u4f8b\u5c3a\uff0c\u5b8c\u5168\u53ef\u4ee5\u6ee1\u8db3\u9700\u8981\u3002\u6211\u53ef\u4ee5\u4ece\u5f00\u6e90\u7684d3\u5e93\u4e2d\u628a\u6bd4\u4f8b\u5c3a\u51fd\u6570\u62bd\u53d6\u51fa\u6765\uff0c\u4e5f\u5f15\u5165\u5230\u8fd9\u4e2a\u9875\u9762\u3002\u6839\u636e\u5b9e\u9645\u6570\u636e\u7684\u6d4b\u8bd5\u7ed3\u679c\uff0c\u6211\u9009\u62e9\u4e86\u5e73\u65b9\u6bd4\u4f8b\u5c3a\u3002\u90a3\u4e48\u63a5\u4e0b\u6765\u5c31\u5f88\u597d\u5199\u4e86\uff1a<\/p>\n<pre class=\"height-set:true width-set:true lang:default decode:true\">var maxTime = 36; \/\/\u672c\u5343\u5c42\u997c\u56fe\u6700\u591a\u663e\u793a60\u4e2a\u6708\u7684\u6570\u636e\uff08\u6700\u591a\u663e\u793a60\u4e2a\u5708\uff09\n\/\/\u539f\u59cb\u6570\u636e\u7684\u52a0\u5de5\u5de5\u5382\u51fd\u6570\n$scope.setData = function(data){\n\t\/\/\u8fd9\u662fD3\u7684\u5e73\u65b9\u6bd4\u4f8b\u5c3a\u51fd\u6570\uff0c\u7528\u4e8e\u6839\u636e\u6570\u636e\u5927\u5c0f\u7f29\u653e\u73af\u7684\u5bbd\u5ea6\n\tvar rScale = d3.scale.sqrt()\n\t\t\t.domain([maxTime, 1])\n\t\t\t.range([3, 30])\n\t\t\t.nice();\n\tconsole.log(rScale(1), rScale(12), rScale(36))\n\t\/\/\u5982\u679c\u6570\u636e\u91cf\u8d85\u8fc760\uff08\u5373\u670960\u4e2a\u6708\uff09\uff0c\u5219\u5220\u966460\u4e2a\u6708\u4e4b\u524d\u7684\u6570\u636e\uff0c\u53ea\u663e\u793a\u6700\u8fd160\u4e2a\u6708\u7684\u5185\u5bb9\n\tif(data.length &gt; maxTime){\n\t\tdata.splice(0, maxTime);\n\t}\n\t\/\/\u7ecf\u8fc7D3\u6bd4\u4f8b\u5c3a\u8ba1\u7b97\u7684\u73af\u7684\u5bbd\u5ea6\n\tvar R = rScale(data.length);\n\tconsole.log(R);\n\tfor(var i=0; i&lt;data.length; i++){\n\t\tdata[i]['type'] = 'pie';\n\t\tdata[i]['radius'] = [i * R + 40, i * R + 40 + R];\t\n\t\t\/\/if(typeof($scope.times[i])!= null)\n\t\tdata[i]['name'] = $scope.times[i];\n\t\tdata[i]['itemStyle'] = {normal : {\n            label : {show : i &gt; (data.length-2)},\n            labelLine : {\n            \tshow : i &gt; (data.length-2), \n    \t\t\tlength:40,\n    \t\t\tcolor : '#f0f',\n        \t\twidth : 10,\n        \t\ttype : 'dotted'\n            }\n        }};\t\t\n\t}\n\n\t\/\/\u663e\u793a\u4e2d\u592e\u6587\u5b57\n\tsetTimeout(function(){\n\t\tvar myDate = new Date();\n\t\tvar myMouth = myDate.getMonth()+1;\n\t\tvar myYear = myDate.getFullYear();    \/\/\u83b7\u53d6\u5b8c\u6574\u7684\u5e74\u4efd(4\u4f4d,1970-????)\n\n\t    \/\/ \u8865\u5145\u5343\u5c42\u997c\u4e2d\u592e\u7684\u8bf4\u660e\u6587\u5b57\n\t\tvar _ZR = myChart.getZrender();\n\t    _ZR.addShape({\n\t        shape : 'text',\n\t        style : {\n\t            x : _ZR.getWidth() \/ 2,\n\t            y : _ZR.getHeight() \/ 2,\n\t            color: 'orange',\n\t            text : data.length + '\u4e2a\u6708\u524d',\n\t            textAlign : 'center'\n\t        }\n\t    });\n\t    _ZR.addShape({\n\t        shape : 'text',\n\t        style : {\n\t            x : _ZR.getWidth() \/ 2 + data.length * R +50,\n\t            y : _ZR.getHeight() \/ 2,\n\t            color: 'orange',\n\t            strokeColor: 'pink',\n\t            text : '\u4eca\u65e5 ' + myYear + \"\u5e74\" + myMouth + \"\u6708\" ,\n\t            textAlign : 'left',\n\t            textFont:'normal 14px \u5fae\u8f6f\u96c5\u9ed1'\n\t        }\n\t    });\n\t    _ZR.refresh();\n\t}, 500);\n\n\treturn data;\n};<\/pre>\n<p>\u8fd9\u6837\uff0c\u65e0\u8bba\u6570\u636e\u91cf\u5927\u5c0f\uff0c\u5e74\u8f6e\u56fe\u90fd\u6709\u53ef\u7528\u6027\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large\" src=\"http:\/\/oysa7b8qz.bkt.clouddn.com\/53EA670944E2A73AF.png\" width=\"586\" height=\"432\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large\" src=\"http:\/\/oysa7b8qz.bkt.clouddn.com\/6545969C7C7B578B65F65E8F53D853165E748F6E56FE2.png\" width=\"1024\" height=\"445\" \/><\/p>\n<p>\u5f53\u7136\uff0c\u505a\u5230\u8fd9\u4e00\u6b65\uff0c\u867d\u7136\u5b9e\u73b0\u4e86\u9700\u6c42\uff0c\u4f46\u6bd5\u7adf\u662f\u7167\u7740\u522b\u4eba\u7684\u4f8b\u5b50\u4fee\u6539\uff0c\u6ca1\u6709\u81ea\u5df1\u521b\u4f5c\u6765\u7684\u6709\u6df1\u5ea6\u3002\u4e0d\u8fc7\u5982\u4f55\u81ea\u5df1\u521b\u4f5c\uff0c\u5c31\u8d85\u8fc7\u4e86\u672c\u6587\u7684\u8303\u7574\uff0c\u5e76\u4e14\u4e5f\u4e0d\u662f\u8fd9\u4e00\u7bc7\u535a\u5ba2\u6240\u80fd\u5305\u542b\u5f97\u4e86\u7684\uff0c\u65e5\u540e\u518d\u8bae\u3002<\/p>\n<p>5.\u6d4f\u89c8\u5668\u517c\u5bb9\u6027\uff1a<\/p>\n<p>\u6700\u540e\u5fc5\u987b\u4e00\u63d0\u6d4f\u89c8\u5668\u517c\u5bb9\u6027\u95ee\u9898\u3002IE8\u3001IE7\u6d4f\u89c8\u5668\u4e0d\u517c\u5bb9canvas\u7ed8\u56fe\uff08IE6\u8bf7\u5141\u8bb8\u6211\u76f4\u63a5\u65e0\u89c6\uff09\uff0c\u4e3a\u4e86\u5b9e\u73b0\u517c\u5bb9\u9700\u8981\u5f15\u5165excanvas_r3\u5e93\u3002<\/p>\n<pre class=\"lang:default decode:true\">&lt;!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --&gt;\n    &lt;!--[if lt IE 9]&gt;\n      &lt;script src=\"application\/views\/frontEnd\/build\/lib\/html5shiv.js\"&gt;&lt;\/script&gt;\n      &lt;script src=\"application\/views\/frontEnd\/build\/lib\/echarts-1.3.8\/excanvas\/excanvas.js\"&gt;&lt;\/script&gt;\n    &lt;![endif]--&gt;<\/pre>\n<p>\u6709\u65f6IE8\u4e2d\u7ed8\u56fe\u9519\u4f4d\uff0c\u52a0\u5165\u4ee5\u4e0b\u4ee3\u7801\u542f\u7528IE7\u517c\u5bb9\u6a21\u5f0f\u5373\u53ef\u89e3\u51b3\uff1a<\/p>\n<pre class=\"lang:default decode:true\">&lt;!-- \u89e3\u51b3IE8\u4e2dcanvas\u7ed8\u56fe\u9519\u4f4d --&gt;\n\t&lt;!--[if lt IE 9]&gt;\n\t&lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=7\" \/&gt;\n\t&lt;![endif]--&gt;<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u6211\u4e00\u76f4\u5728\u505a\u6570\u636e\u53ef\u89c6\u5316\u7684\u524d\u7aef\u5de5\u4f5c\uff0c\u6211\u7528<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,12],"tags":[78,79,87,110],"class_list":["post-889","post","type-post","status-publish","format-standard","hentry","category-web-frontend","category-data-visualization","tag-78","tag-79","tag-87","tag-110"],"_links":{"self":[{"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/posts\/889","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/comments?post=889"}],"version-history":[{"count":0,"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/posts\/889\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/media?parent=889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/categories?post=889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/tags?post=889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}