{"id":495,"date":"2014-12-09T21:53:14","date_gmt":"2014-12-09T13:53:14","guid":{"rendered":"http:\/\/www.luwl.net\/?p=495"},"modified":"2014-12-09T22:12:51","modified_gmt":"2014-12-09T14:12:51","slug":"echarts%e4%bd%bf%e7%94%a8%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"http:\/\/www.luwl.net\/?p=495","title":{"rendered":"echarts\u4f7f\u7528\u7b14\u8bb0"},"content":{"rendered":"<p>echarts\u662f\u767e\u5ea6\u4e00\u4e2a\u6b63\u513f\u516b\u7ecf\u7684\u826f\u5fc3\u8d27\uff0c\u514d\u8d39\u5f00\u6e90\uff0c\u529f\u80fd\u5f3a\u5927\u3002<br \/>\n\u8fd1\u65e5\u60f3\u6765\u8ba9echarts\u7528\u4e8e\u516c\u53f8\u6280\u672f\u4e2d\u5fc3\u751f\u4ea7\u6570\u636e\u7684\u8d8b\u52bf\u753b\u56fe\uff0c\u628a\u751f\u4ea7\u4e0a\u586b\u62a5\u7684\u8868\u683c\u7528\u56fe\u6807\u663e\u793a\u51fa\u6765\u3002\u60f3\u60f3\u8fd8\u662f\u6709\u70b9\u7528\u3002<br \/>\n1\u3001echart\u6837\u4f8b\uff1a<br \/>\n<code><br \/>\n<!DOCTYPE html><br \/>\n<head><br \/>\n    <meta charset=\"utf-8\"><br \/>\n    <title>ECharts<\/title><br \/>\n<\/head><br \/>\n<body><br \/>\n    <!-- \u4e3aECharts\u51c6\u5907\u4e00\u4e2a\u5177\u5907\u5927\u5c0f\uff08\u5bbd\u9ad8\uff09\u7684Dom --><\/p>\n<div id=\"main\" style=\"height:400px\"><\/div>\n<p>    <!-- ECharts\u5355\u6587\u4ef6\u5f15\u5165 --><br \/>\n    <script src=\"http:\/\/echarts.baidu.com\/build\/dist\/echarts.js\"><\/script><br \/>\n    <script type=\"text\/javascript\">\n        \/\/ \u8def\u5f84\u914d\u7f6e\n        require.config({\n            paths: {\n                echarts: 'http:\/\/echarts.baidu.com\/build\/dist'\n            }\n        });<\/p>\n<p>        \/\/ \u4f7f\u7528\n        require(\n            [\n                'echarts',\n                'echarts\/chart\/bar' \/\/ \u4f7f\u7528\u67f1\u72b6\u56fe\u5c31\u52a0\u8f7dbar\u6a21\u5757\uff0c\u6309\u9700\u52a0\u8f7d\n            ],\n            function (ec) {\n                \/\/ \u57fa\u4e8e\u51c6\u5907\u597d\u7684dom\uff0c\u521d\u59cb\u5316echarts\u56fe\u8868\n                var myChart = ec.init(document.getElementById('main')); <\/p>\n<p>                var option = {\n                    tooltip: {\n                        show: true\n                    },\n                    legend: {\n                        data:['\u9500\u91cf']\n                    },\n                    xAxis : [\n                        {\n                            type : 'category',\n                            data : [\"\u886c\u886b\",\"\u7f8a\u6bdb\u886b\",\"\u96ea\u7eba\u886b\",\"\u88e4\u5b50\",\"\u9ad8\u8ddf\u978b\",\"\u889c\u5b50\"]\n                        }\n                    ],\n                    yAxis : [\n                        {\n                            type : 'value'\n                        }\n                    ],\n                    series : [\n                        {\n                            \"name\":\"\u9500\u91cf\",\n                            \"type\":\"bar\",\n                            \"data\":[5, 20, 40, 10, 10, 20]\n                        }\n                    ]\n                };<\/p>\n<p>                \/\/ \u4e3aecharts\u5bf9\u8c61\u52a0\u8f7d\u6570\u636e \n                myChart.setOption(option); \n            }\n        );\n    <\/script><br \/>\n<\/body><br \/>\n<\/code><\/p>\n<p>\u53ef\u662f\u6211\u4e0d\u77e5\u9053\u4ece\u54ea\u91cc\u770b\u5230\u4e86\u4e00\u4e2a\u8ddf\u8fd9\u4e2a\u6709\u4e00\u70b9\u4e0d\u540c\uff0c\u5c31\u4e00\u76f4\u7528\u4e0b\u4e86\u3002\u4ee3\u7801\u662f\u8fd9\u6837\u7528\u7684\uff1a<\/p>\n<p><code><br \/>\n<!-- \u4e3aECharts\u51c6\u5907\u4e00\u4e2a\u5177\u5907\u5927\u5c0f\uff08\u5bbd\u9ad8\uff09\u7684Dom --><\/p>\n<div id=\"main\" style=\"height:400px\"><\/div>\n<p>    <!-- ECharts\u5355\u6587\u4ef6\u5f15\u5165 --><br \/>\n<script src=\"http:\/\/192.168.100.10\/echarts-all.js\" ><\/script><br \/>\n    <script type=\"text\/javascript\">\n        \/\/ \u57fa\u4e8e\u51c6\u5907\u597d\u7684dom\uff0c\u521d\u59cb\u5316echarts\u56fe\u8868\n        var myChart = echarts.init(document.getElementById('main')); <\/p>\n<p>        option = {\n            tooltip : {\n                trigger: 'axis'\n            },\n            legend: {\n                data:['6#\u5f00\u5ea6','\u6f84\u6e05\u6c60\u5e95']\n            },\n            toolbox: {\n                show : true,\n                feature : {\n                    mark : {show: false},\n                    dataView : {show: false, readOnly: false},\n                    magicType : {show: false, type: ['line', 'bar', 'stack', 'tiled']},\n                    restore : {show: true},\n                    saveAsImage : {show: true}\n                }\n            },\n            calculable : true,\n            xAxis : [\n                {\n                    type : 'category',\n                    boundaryGap : false,\n                    data : ['1','2','5','6','9','10','13','15','18','19','21','22']\n                }\n            ],\n            yAxis : [\n                {\n                    type : 'value'\n                }\n            ],\n            series : [\n                {\n                 name:'6#\u5f00\u5ea6',\n                 type:'line',\n                 data:[321,3213,321,321,132,13232,12321,231,132,1,1,31]\n                 },\n                {\n                name:'\u6f84\u6e05\u6c60\u5e95',\n                type:'line',\n                data:[132,321,321,132,321,321,3213,321,321,1,31,132]\n                }\n             ]\n        };<\/p>\n<p>        \/\/ \u4e3aecharts\u5bf9\u8c61\u52a0\u8f7d\u6570\u636e \n        myChart.setOption(option); \n    <\/script><\/p>\n<p><\/code><br \/>\n\u7136\u540e\uff0c\u8c37\u6b4c\u6d4f\u89c8\u5668\u6267\u884c\u6ca1\u95ee\u9898\uff0cIE\u4e5f\u6ca1\u6709\u95ee\u9898\u3002<br \/>\n\u7531\u4e8eecharts\u662futf-8\u7f16\u7801\u7684\uff0c\u6240\u4ee5\u6211\u505a\u6d4b\u8bd5\u4e5f\u7528utf-8\u65f6\u6ca1\u95ee\u9898\u3002\u4f46\u95ee\u9898\u662f\u6211\u6570\u636e\u5e93\u91cc\u5305\u542b\u4e2d\u6587\u5b57\u6bb5\uff0c\u7528utf-8\u5c31\u4e71\u7801\u4e86\uff0c\u5fc5\u987b\u7528GBK\u3002\u628a\u4ee3\u7801\u7528GBK\u65b9\u5f0f\u4fdd\u5b58\u540eIE\u5c31\u4e0d\u663e\u793a\u4e86\uff0c\u8c37\u6b4c\u6b63\u5e38\u3002\uff08\u539f\u672c\u4ee5\u4e3a\u6211\u54ea\u91cc\u51fa\u9519\u4e86\uff0c\u627e\u4e86\u534a\u5929\u624d\u660e\u767d\u662f\u7f16\u7801\u95ee\u9898\u3002\uff09<br \/>\n\u5904\u7406\u7684\u65b9\u5f0f\u4e5f\u7b80\u5355\uff0c\u5728\u8c03\u7528\u4ee3\u7801\u65f6\u5019\u52a0\u4e0a\u7f16\u7801\u7684\u58f0\u660e\u5c31\u884c\u4e86\uff1a<br \/>\n<code><script src=\"http:\/\/192.168.100.10\/echarts-all.js\" charset=\"utf-8\"><\/script><br \/>\n<\/code><br \/>\n\u8fd9\u65f6\uff0c\u90fd\u6b63\u5e38\u4e86\u3002<br \/>\n\u4e0b\u9762\u5c31\u8bf4\u8bf4\u4e3a\u4e86\u5b9e\u73b0\u8c03\u7528\u6570\u636e\u5e93\uff0c\u6211\u5b66\u4e60\u7684\u5427\uff1a<br \/>\n\u5b9e\u73b0\u8c03\u7528\u6570\u636e\u7684asp\u4ee3\u7801\uff1a<br \/>\n<code><br \/>\n<!DOCTYPE html><br \/>\n<head><br \/>\n    <meta charset=\"gbk\"><br \/>\n    <title>\u5de5\u827a\u6307\u6807\u8d8b\u52bf<\/title><br \/>\n<\/head><br \/>\n<body><br \/>\n<%\n    dim conn,connstr,rs,sql\n    set conn = Server.CreateObject(\"Adodb.Connection\")\n    connstr = \"Provider=SQLOLEDB;data source=127.0.0.1;initial catalog=OA;uid=sa;pwd=**\"\/\/sqlserver2000\u6570\u636e\u5e93\u7684\u8fde\u63a5\uff0c\u5bc6\u7801\u9690\u85cf\u4e86\n    conn.open connstr\n        \/\/\u83b7\u53d6RCID\n        set rs = Server.CreateObject(\"Adodb.RecordSet\")\n        sql = \"select ExcelServerRCID from \u6d6e\u6cd5\u56db\u7ebf\u7194\u5316_\u4e3b\u8868\"\/\/\u6570\u636e\u5e93\u662fexcle\u670d\u52a1\u5668\u7684\u6570\u636e\u5e93\uff0c\u4f7f\u7528\u4e86\u4e2d\u6587\u8868\u540d\u3002\u5728\u8fd9\u91cc\u53ef\u4ee5\u6307\u5b9a\u662f\u54ea\u4e00\u4e2a\u8868\uff0c\u6bd4\u5982\u6309\u7167\u65e5\u671f\u8fdb\u884c\u6307\u5b9a\u3002\u56e0\u4e3a\u6570\u636e\u5e93\u91cc\u53ea\u6709\u4e00\u5f20\u8868\uff0c\u5c31\u4e0d\u8fdb\u884c\u6307\u5b9a\u4e86\u3002\n        rs.open sql,conn,1,1\n        if not rs.eof then\n         RCID = rs(\"ExcelServerRCID\")\n         else \n         RCID = \"\"\n         response.write \"\u627e\u4e0d\u5230\u6570\u636e\"\n        end if\n        rs.close\n%><br \/>\n<a href=\"esweb\/\">\u6570\u636e\u586b\u62a5\u7cfb\u7edf\u5165\u53e3<\/a><br \/>\n    <!-- \u4e3aECharts\u51c6\u5907\u4e00\u4e2a\u5177\u5907\u5927\u5c0f\uff08\u5bbd\u9ad8\uff09\u7684Dom --><\/p>\n<div id=\"main\" style=\"height:400px\"><\/div>\n<p>    <!-- ECharts\u5355\u6587\u4ef6\u5f15\u5165 --><br \/>\n    <script src=\"echarts-all.js\" charset=\"utf-8\"><\/script>\/\/\u56e0\u4e3a\u662fGBK\u7f16\u7801\uff0c\u8c03\u7528utf-8\u7684js\u6587\u4ef6\u5fc5\u987b\u6307\u5b9a\u7f16\u7801\u3002<br \/>\n    <script type=\"text\/javascript\"><\/p>\n<p>        \/\/ \u57fa\u4e8e\u51c6\u5907\u597d\u7684dom\uff0c\u521d\u59cb\u5316echarts\u56fe\u8868\n        var myChart = echarts.init(document.getElementById('main')); <\/p>\n<p>        var option = {\n            tooltip : {\n                trigger: 'axis'\n            },\n            legend: {\n                data:[\n                <%               \n                 \/\/\u83b7\u53d6RCID\u660e\u7ec6\u4e2d\u53c2\u6570\u70b9\u70b9\n                  set rs0 = Server.CreateObject(\"Adodb.RecordSet\")\n                  sql0 = \"select distinct \u53c2\u6570\u70b9 from \u6d6e\u6cd5\u56db\u7ebf\u7194\u5316_\u660e\u7ec6 where ExcelServerRCID = '\" &#038; RCID &#038;\"'\"\/\/distinct \u53c2\u6570\u70b9 \u662f\u8bf4\u76f8\u540c\u53c2\u6570\u70b9\u53ea\u8fd4\u56de\u4e00\u4e2a\u503c\u3002\u8fd9\u5c31\u5f97\u5230\u4e86\u6240\u6709\u79cd\u7c7b\u7684\u53c2\u6570\uff0c\u4e14\u6ca1\u6709\u91cd\u590d\u3002\n                  rs0.open sql0,conn,1,1\n                  if not rs0.eof then\n                    while not rs0.eof\n                      response.write \"'\"&#038; rs0(\"\u53c2\u6570\u70b9\") &#038;\"'\"\n                      rs0.movenext\n                        if not rs0.eof then\/\/\u8fd9\u79cd\u7528\u6cd5\u662f\u7528\u9017\u53f7\u5206\u9694\u6570\u636e\uff0c\u5982\u679c\u4e0d\u662f\u6700\u540e\u4e00\u4e2a\u5c31\u52a0\u9017\u53f7\uff0c\u6700\u540e\u4e00\u4e2a\u5c31\u4e0d\u52a0\u4e86\u3002\n                          response.write \",\"\n                        end if\n                    wend\n                   else \n                   response.write \"\"\n                  end if\n                  rs0.close\n                 %>\n             ]   \n            },\n            toolbox: {\n                show : true,\n                feature : {\n                    mark : {show: false},\n                    dataView : {show: false, readOnly: false},\n                    magicType : {show: false, type: ['line', 'bar', 'stack', 'tiled']},\n                    restore : {show: true},\n                    saveAsImage : {show: true}\n                }\n            },\n            calculable : true,\n            xAxis : [\n                {\n                    type : 'category',\n                    boundaryGap : false,\n                    data : [\n                    <%\n                    \/\/\u83b7\u53d6RCID\u660e\u7ec6\u4e2d\u65f6\u95f4\u70b9\n                    set rs1 = Server.CreateObject(\"Adodb.RecordSet\")\n                    sql1 = \"select distinct cast(\u65f6\u95f4 as int) as '\u65f6\u95f4'  from \u6d6e\u6cd5\u56db\u7ebf\u7194\u5316_\u660e\u7ec6 where ExcelServerRCID = '\" &#038; RCID &#038;\"'\"\/\/cast(\u65f6\u95f4 as int) as '\u65f6\u95f4'\u76ee\u7684\u662f\u8ba9\u8fd4\u56de\u7684\u6587\u5b57\u578b\u8f6c\u6362\u4e3a\u6570\u503c\u578b\uff0c\u4e0d\u7136\u6392\u5e8f\u5c31\u4e0d\u662f\u60f3\u8981\u7684\u4e86\u3002\n                    rs1.open sql1,conn,1,1\n                    if not rs1.eof then\n                      while not rs1.eof\n                        response.write \"'\"&#038; rs1(\"\u65f6\u95f4\")&#038;\"'\"\n                        rs1.movenext\n                          if not rs1.eof then\n                            response.write \",\"\n                          end if\n                      wend\n                     else \n                     response.write \"\u627e\u4e0d\u5230\u6570\u636e\"\n                    end if\n                    rs1.close\n                    %>\n                    ]\n                }\n            ],\n            yAxis : [\n                {\n                    type : 'value'\n                }\n            ],\n            series : [\n                <%\n                set rs2 = Server.CreateObject(\"Adodb.RecordSet\")\n                sql2 = \"select distinct \u53c2\u6570\u70b9 from \u6d6e\u6cd5\u56db\u7ebf\u7194\u5316_\u660e\u7ec6 where ExcelServerRCID = '\" &#038; RCID &#038;\"'\"\n                rs2.open sql2,conn,1,1\n                if not rs2.eof then\n                  while not rs2.eof\n                    response.write \"{\"&#038;vbcrlf&#038;\"name:'\"&#038;rs2(\"\u53c2\u6570\u70b9\")&#038;\"',\"&#038;vbcrlf\n                    response.write \"type:'line',\"&#038;vbcrlf\n                    'response.write \"stack: '\u603b\u91cf',\"&#038;vbcrlf\n                    response.write\"data:[\"\n                          set rs3 = Server.CreateObject(\"Adodb.RecordSet\")\n                          sql3 = \"select \u6570\u636e from \u6d6e\u6cd5\u56db\u7ebf\u7194\u5316_\u660e\u7ec6 where ExcelServerRCID = '\" &#038; RCID &#038;\"' and \u53c2\u6570\u70b9='\"&#038;rs2(\"\u53c2\u6570\u70b9\")&#038;\"'order by cast(\u65f6\u95f4 as int) asc\"\/\/\u4e3a\u4e86\u8ba9\u8fd4\u56de\u7684\u6570\u636e\u6309\u7167\u65f6\u95f4\u8fdb\u884c\u6392\u5217\uff0c\u52a0\u4e0a\u4e86order by cast(\u65f6\u95f4 as int) asc\u3002\n                          'response.write sql3\n                          rs3.open sql3,conn,1,1\n                          if not rs3.eof then\n                            while not rs3.eof\n                              response.write rs3(\"\u6570\u636e\")\n                              rs3.movenext\n                                 if not rs3.eof then\n                                    response.write \",\"\n                                 end if\n                            wend\n                           else \n                           response.write \"\u627e\u4e0d\u5230\u6570\u636e\"\n                          end if\n                          rs3.close     \n                    response.write\"]\"&#038;vbcrlf&#038;\"}\"\n                    rs2.movenext\n                        if not rs2.eof then\n                          response.write \",\"&#038;vbcrlf\n                        end if\n                  wend\n                 else \n                 response.write \"\u627e\u4e0d\u5230\u6570\u636e\"\n                end if\n                rs2.close\n                %>\n            ]\n        };<\/p>\n<p>        \/\/ \u4e3aecharts\u5bf9\u8c61\u52a0\u8f7d\u6570\u636e \n        myChart.setOption(option); \n    <\/script><br \/>\n<%\n      conn.close\n    set conn=nothing\n%><br \/>\n<\/body><br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>echarts\u662f\u767e\u5ea6\u4e00\u4e2a\u6b63\u513f\u516b\u7ecf\u7684\u826f\u5fc3\u8d27\uff0c\u514d\u8d39\u5f00\u6e90\uff0c\u529f\u80fd\u5f3a\u5927\u3002 \u8fd1\u65e5\u60f3\u6765\u8ba9ech &hellip; <a href=\"http:\/\/www.luwl.net\/?p=495\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-495","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.luwl.net\/index.php?rest_route=\/wp\/v2\/posts\/495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.luwl.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.luwl.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.luwl.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.luwl.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=495"}],"version-history":[{"count":4,"href":"http:\/\/www.luwl.net\/index.php?rest_route=\/wp\/v2\/posts\/495\/revisions"}],"predecessor-version":[{"id":499,"href":"http:\/\/www.luwl.net\/index.php?rest_route=\/wp\/v2\/posts\/495\/revisions\/499"}],"wp:attachment":[{"href":"http:\/\/www.luwl.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.luwl.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=495"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.luwl.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}