{"id":2305,"date":"2017-11-03T15:55:35","date_gmt":"2017-11-03T07:55:35","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2305"},"modified":"2017-11-03T16:01:16","modified_gmt":"2017-11-03T08:01:16","slug":"svg-%e5%9b%be%e8%a1%a8%e6%8f%92%e4%bb%b6-frappe-%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2305","title":{"rendered":"SVG \u56fe\u8868\u63d2\u4ef6 charts \u6559\u7a0b"},"content":{"rendered":"<p>\n\t<a href=\"https:\/\/github.com\/frappe\/charts\" name=\"frappe\" target=\"_blank\" title=\"frappe\">frappe<\/a> \u662f\u4e00\u4e2a\u7b80\u5355\uff0c\u654f\u611f\uff0c\u73b0\u4ee3\u7684<a href=\"https:\/\/www.xttblog.com\/?tag=SVG\" name=\"SVG\" target=\"_blank\" title=\"SVG\">SVG<\/a>\u56fe\u8868\u63d2\u4ef6\uff0c\u5177\u6709\u96f6\u4f9d\u8d56\u6027\uff0c\u5373\u5b83\u53ef\u4ee5\u5355\u72ec\u4f7f\u7528\uff0c\u4e0d\u4f9d\u8d56\u5176\u4ed6\u4efb\u4f55js\u5e93\u3002\u672c\u6587\u4ecb\u7ecd\u5b83\u7684\u7528\u6cd5\u3002\n<\/p>\n<p>\n\t\u76ee\u524d frappe charts \u5728 github \u4e0a\u5df2\u67094000\u591a\u9897\u661f\u3002\n<\/p>\n<h2>\n\t\u5b89\u88c5<br \/>\n<\/h2>\n<p>\n\tfrappe \u7684\u5b89\u88c5\u6709\u4e24\u79cd\u65b9\u6cd5\u3002\u65b9\u6cd5\u4e00\u662f\u901a\u8fc7 npm \u5b89\u88c5\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n$ npm install frappe-charts<\/pre>\n<p>\n\t\u65b9\u6cd5\u4e8c\u662f\u76f4\u63a5\u5728\u7f51\u9875\u4e2d\u5f15\u7528\u5b83\u3002\n<\/p>\n<pre class=\"brush:xml;\">\r\n&lt;script src=&quot;https:\/\/raw.githubusercontent.com\/frappe\/charts\/master\/dist\/frappe-charts.min.js&quot;&gt;&lt;\/script&gt;<\/pre>\n<h2>\n\t\u7528\u6cd5<br \/>\n<\/h2>\n<p>\n\t\u770b\u4e0b\u9762\u4e00\u4e2a\u800c\u7b80\u5355\u7684\u4f8b\u5b50\u3002\n<\/p>\n<pre class=\"brush:jscript;\">\r\nconst data = {\r\n    labels: [&quot;12am-3am&quot;, &quot;3am-6pm&quot;, &quot;6am-9am&quot;, &quot;9am-12am&quot;,\r\n        &quot;12pm-3pm&quot;, &quot;3pm-6pm&quot;, &quot;6pm-9pm&quot;, &quot;9am-12am&quot;\r\n    ],\r\n    datasets: [\r\n        {\r\n            title: &quot;Some Data&quot;,\r\n            color: &quot;light-blue&quot;,\r\n            values: [25, 40, 30, 35, 8, 52, 17, -4]\r\n        },\r\n        {\r\n            title: &quot;Another Set&quot;,\r\n            color: &quot;violet&quot;,\r\n            values: [25, 50, -10, 15, 18, 32, 27, 14]\r\n        }\r\n    ]\r\n}\r\nconst chart = new Chart({\r\n    parent: &#039;#chart&#039;,\r\n    title: &quot;My Awesome Chart&quot;,\r\n    data: data,\r\n    type: &#039;bar&#039;, \/\/ or &#039;line&#039;, &#039;scatter&#039;, &#039;percentage&#039;\r\n    height: 250\r\n})<\/pre>\n<p>\n\t\u4f60\u53ef\u4ee5\u76f4\u63a5\u514b\u9686github\u4e0a\u5e26\u6e90\u7801\uff0c\u8fd0\u884c\u5b83\u7684demo\u3002\u7528\u6cd5\u5982\u4e0b\uff1a\n<\/p>\n<ol>\n<li>\n\t\tclone \u8fd9\u4e2a\u9879\u76eehttps:\/\/github.com\/frappe\/charts.git\n\t<\/li>\n<li>\n\t\tcd \u8fdb\u5165\u9879\u76ee\u76ee\u5f55\n\t<\/li>\n<li>\n\t\tnpm install\n\t<\/li>\n<li>\n\t\tnpm run dev\n\t<\/li>\n<\/ol>\n<p>\n\t<img decoding=\"async\" alt=\"Frappe\u56fe\u8868\" src=\"https:\/\/github.com\/frappe\/charts\/raw\/master\/.github\/example.gif\" style=\"width: 942px;height: 294px\" \/>\n<\/p>\n<p>\n\t\u4e0a\u56fe\u5c31\u662f\u5b98\u65b9demo\u7684\u8fd0\u884c\u6548\u679c\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2305\">SVG \u56fe\u8868\u63d2\u4ef6 charts \u6559\u7a0b<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>frappe \u662f\u4e00\u4e2a\u7b80\u5355\uff0c\u654f\u611f\uff0c\u73b0\u4ee3\u7684SVG\u56fe\u8868\u63d2\u4ef6\uff0c\u5177\u6709\u96f6\u4f9d\u8d56\u6027\uff0c\u5373\u5b83\u53ef\u4ee5\u5355\u72ec\u4f7f\u7528\uff0c\u4e0d\u4f9d\u8d56\u5176\u4ed6\u4efb\u4f55js\u5e93\u3002\u672c [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[1571,1106,52],"class_list":["post-2305","post","type-post","status-publish","format-standard","hentry","category-html5","tag-frappe","tag-javascript","tag-svg"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2305"}],"version-history":[{"count":3,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2305\/revisions"}],"predecessor-version":[{"id":2309,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2305\/revisions\/2309"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}