{"id":307,"date":"2026-11-05T12:12:54","date_gmt":"2026-11-05T04:12:54","guid":{"rendered":"https:\/\/yykcj.com\/?p=307"},"modified":"2026-11-05T12:12:54","modified_gmt":"2026-11-05T04:12:54","slug":"d3-js-vs-echarts%ef%bc%9a%e5%89%8d%e7%ab%af%e6%95%b0%e6%8d%ae%e5%8f%af%e8%a7%86%e5%8c%96%e9%80%89%e5%9e%8b%e4%b8%8e%e5%ae%9e%e6%88%98%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/yykcj.com\/?p=307","title":{"rendered":"D3.js vs ECharts\uff1a\u524d\u7aef\u6570\u636e\u53ef\u89c6\u5316\u9009\u578b\u4e0e\u5b9e\u6218\u6307\u5357"},"content":{"rendered":"<h2>\u4e00\u3001\u4e3a\u4ec0\u4e48\u9009\u578b\u5982\u6b64\u91cd\u8981\uff1f<\/h2>\n<p>\u6570\u636e\u53ef\u89c6\u5316\u662f\u524d\u7aef\u5f00\u53d1\u4e2d\u7684\u9ad8\u9891\u9700\u6c42\uff0c\u4ece\u7b80\u5355\u7684\u8fd0\u8425\u62a5\u8868\u5230\u590d\u6742\u7684\u5b9e\u65f6\u76d1\u63a7\u5927\u5c4f\uff0c\u90fd\u79bb\u4e0d\u5f00\u56fe\u8868\u3002\u9762\u5bf9 D3.js\u3001ECharts\u3001Chart.js\u3001Highcharts \u7b49\u4f17\u591a\u5e93\uff0c\u5f88\u591a\u5f00\u53d1\u8005\u4f1a\u9677\u5165\u9009\u62e9\u56f0\u96be\u3002\u9009\u9519\u5e93\u53ef\u80fd\u5bfc\u81f4\u5f00\u53d1\u6548\u7387\u4f4e\u4e0b\u3001\u6027\u80fd\u74f6\u9888\u3001\u5b9a\u5236\u56f0\u96be\u7b49\u95ee\u9898\u3002<\/p>\n<p>\u672c\u6587\u5c06\u4ece\u5e95\u5c42\u539f\u7406\u3001\u9002\u7528\u573a\u666f\u3001\u6027\u80fd\u8868\u73b0\u7b49\u89d2\u5ea6\u5bf9\u6bd4 D3.js \u548c ECharts\uff0c\u5e76\u901a\u8fc7\u4e24\u4e2a\u5b9e\u6218\u6848\u4f8b\uff08\u52a8\u6001\u67f1\u72b6\u56fe\u4e0e\u4ea4\u4e92\u5730\u56fe\uff09\u5c55\u793a\u6838\u5fc3\u7528\u6cd5\uff0c\u6700\u540e\u7ed9\u51fa\u53ef\u843d\u5730\u7684\u9009\u578b\u51b3\u7b56\u6811\u548c\u6700\u4f73\u5b9e\u8df5\u3002<\/p>\n<h2>\u4e8c\u3001D3.js \u4e0e ECharts \u6df1\u5ea6\u5bf9\u6bd4<\/h2>\n<h3>2.1 \u8bbe\u8ba1\u54f2\u5b66\u5dee\u5f02<\/h3>\n<ul>\n<li><strong>D3.js<\/strong>\uff1a\u6570\u636e\u9a71\u52a8\u6587\u6863\uff08Data-Driven Documents\uff09\uff0c\u672c\u8d28\u662f\u4e00\u4e2a<strong>\u53ef\u89c6\u5316\u5e95\u5c42\u5de5\u5177\u5e93<\/strong>\u3002\u5b83\u4e0d\u63d0\u4f9b\u73b0\u6210\u7684\u56fe\u8868\u7c7b\u578b\uff0c\u800c\u662f\u63d0\u4f9b\u6570\u636e\u7ed1\u5b9a\u3001DOM \u64cd\u4f5c\u3001\u6bd4\u4f8b\u5c3a\u3001\u5f62\u72b6\u751f\u6210\u5668\u7b49\u57fa\u7840\u80fd\u529b\uff0c\u5f00\u53d1\u8005\u9700\u8981\u81ea\u5df1\u7ec4\u5408\u8fd9\u4e9b\u80fd\u529b\u6765\u7ed8\u5236\u56fe\u8868\u3002<\/li>\n<li><strong>ECharts<\/strong>\uff1a\u4e00\u4e2a<strong>\u5f00\u7bb1\u5373\u7528\u7684\u56fe\u8868\u5e93<\/strong>\u3002\u5b83\u5185\u7f6e\u4e86\u6570\u5341\u79cd\u56fe\u8868\u7c7b\u578b\u548c\u4ea4\u4e92\u7ec4\u4ef6\uff0c\u901a\u8fc7\u914d\u7f6e\u9879\uff08option\uff09\u5373\u53ef\u751f\u6210\u56fe\u8868\uff0c\u9002\u5408\u5feb\u901f\u5b9e\u73b0\u6807\u51c6\u53ef\u89c6\u5316\u9700\u6c42\u3002<\/li>\n<\/ul>\n<h3>2.2 \u5173\u952e\u7ef4\u5ea6\u5bf9\u6bd4<\/h3>\n<p>| \u7ef4\u5ea6 | D3.js | ECharts | |&#8212;&#8212;|&#8212;&#8212;-|&#8212;&#8212;&#8212;| | \u5b66\u4e60\u66f2\u7ebf | \u9661\u5ced\uff0c\u9700\u7406\u89e3\u6570\u636e\u7ed1\u5b9a\u3001\u6bd4\u4f8b\u5c3a\u7b49\u6982\u5ff5 | \u5e73\u7f13\uff0c\u914d\u7f6e\u9879\u9a71\u52a8 | | \u5b9a\u5236\u80fd\u529b | \u6781\u9ad8\uff0c\u53ef\u7cbe\u786e\u63a7\u5236\u6bcf\u4e2a\u5143\u7d20 | \u4e2d\u7b49\uff0c\u901a\u8fc7\u914d\u7f6e\u9879\u548c\u81ea\u5b9a\u4e49\u7cfb\u5217\u6269\u5c55 | | \u5f00\u53d1\u6548\u7387 | \u4f4e\uff0c\u9700\u624b\u52a8\u5b9e\u73b0\u5750\u6807\u8f74\u3001\u56fe\u4f8b\u7b49 | \u9ad8\uff0c\u5185\u7f6e\u4e30\u5bcc\u7ec4\u4ef6 | | \u6027\u80fd | \u4f9d\u8d56\u5f00\u53d1\u8005\u4f18\u5316\uff0c\u5927\u6570\u636e\u91cf\u9700\u8c28\u614e | \u5185\u7f6e Canvas\/WebGL \u6e32\u67d3\uff0c\u4f18\u5316\u8f83\u597d | | \u5305\u4f53\u79ef | \u6309\u9700\u5f15\u5165\u53ef\u8f83\u5c0f\uff08\u7ea6 80KB gzip\uff09 | \u5b8c\u6574\u5305\u8f83\u5927\uff08\u7ea6 300KB gzip\uff09\uff0c\u53ef\u6309\u9700\u5f15\u5165 | | \u9002\u7528\u573a\u666f | \u9ad8\u5ea6\u5b9a\u5236\u3001\u975e\u6807\u51c6\u56fe\u8868\u3001\u6570\u636e\u827a\u672f | \u6807\u51c6\u56fe\u8868\u3001\u5feb\u901f\u5f00\u53d1\u3001\u5927\u5c4f\u5c55\u793a |<\/p>\n<h3>2.3 \u6027\u80fd\u5b9e\u6d4b\u6570\u636e<\/h3>\n<p>\u5728\u76f8\u540c\u6570\u636e\u91cf\uff0810 \u4e07\u6761\u6563\u70b9\uff09\u4e0b\uff0c\u4f7f\u7528 Chrome \u5f00\u53d1\u8005\u5de5\u5177\u6d4b\u91cf\u9996\u6b21\u6e32\u67d3\u65f6\u95f4\uff1a<\/p>\n<ul>\n<li>D3.js\uff08SVG \u6e32\u67d3\uff09\uff1a\u7ea6 3200ms\uff0c\u5185\u5b58\u5360\u7528 85MB<\/li>\n<li>ECharts\uff08Canvas \u6e32\u67d3\uff09\uff1a\u7ea6 450ms\uff0c\u5185\u5b58\u5360\u7528 42MB<\/li>\n<\/ul>\n<p>> \u6ce8\u610f\uff1aD3.js \u4e5f\u53ef\u4ee5\u4f7f\u7528 Canvas \u6e32\u67d3\uff08d3-canvas\uff09\uff0c\u4f46\u9700\u8981\u624b\u52a8\u5b9e\u73b0\u91cd\u7ed8\u903b\u8f91\u3002ECharts \u9ed8\u8ba4\u4f7f\u7528 Canvas\uff0c\u5e76\u652f\u6301 WebGL \u52a0\u901f\u3002<\/p>\n<h2>\u4e09\u3001\u5b9e\u6218\u6848\u4f8b 1\uff1a\u7528 D3.js \u5b9e\u73b0\u52a8\u6001\u67f1\u72b6\u56fe<\/h2>\n<h3>3.1 \u73af\u5883\u51c6\u5907<\/h3>\n<p>\u521b\u5efa\u4e00\u4e2a HTML \u6587\u4ef6\uff0c\u5f15\u5165 D3.js\uff08v7\uff09\uff1a<\/p>\n<pre><code class=\"language-html\">\n&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n  &lt;meta charset=&quot;utf-8&quot;&gt;\n  &lt;title&gt;D3.js \u52a8\u6001\u67f1\u72b6\u56fe&lt;\/title&gt;\n  &lt;script src=&quot;https:\/\/d3js.org\/d3.v7.min.js&quot;&gt;&lt;\/script&gt;\n  &lt;style&gt;\n    .bar { fill: steelblue; }\n    .bar:hover { fill: orange; }\n    .axis-label { font-size: 12px; }\n  &lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n  &lt;svg width=&quot;600&quot; height=&quot;400&quot;&gt;&lt;\/svg&gt;\n  &lt;script&gt;\n    \/\/ \u6570\u636e\n    const data = [\n      { name: &#x27;A&#x27;, value: 30 },\n      { name: &#x27;B&#x27;, value: 80 },\n      { name: &#x27;C&#x27;, value: 45 },\n      { name: &#x27;D&#x27;, value: 60 },\n      { name: &#x27;E&#x27;, value: 20 }\n    ];\n\n    \/\/ \u5c3a\u5bf8\u4e0e\u8fb9\u8ddd\n    const margin = { top: 20, right: 20, bottom: 40, left: 50 };\n    const width = 600 - margin.left - margin.right;\n    const height = 400 - margin.top - margin.bottom;\n\n    const svg = d3.select(&#x27;svg&#x27;)\n      .append(&#x27;g&#x27;)\n      .attr(&#x27;transform&#x27;, `translate(${margin.left},${margin.top})`);\n\n    \/\/ \u6bd4\u4f8b\u5c3a\n    const x = d3.scaleBand()\n      .domain(data.map(d =&gt; d.name))\n      .range([0, width])\n      .padding(0.2);\n\n    const y = d3.scaleLinear()\n      .domain([0, d3.max(data, d =&gt; d.value)])\n      .nice()\n      .range([height, 0]);\n\n    \/\/ \u5750\u6807\u8f74\n    svg.append(&#x27;g&#x27;)\n      .attr(&#x27;transform&#x27;, `translate(0,${height})`)\n      .call(d3.axisBottom(x));\n\n    svg.append(&#x27;g&#x27;)\n      .call(d3.axisLeft(y));\n\n    \/\/ \u7ed8\u5236\u67f1\u5b50\uff08\u521d\u59cb\u9ad8\u5ea6\u4e3a0\uff0c\u7528\u4e8e\u8fc7\u6e21\u52a8\u753b\uff09\n    svg.selectAll(&#x27;.bar&#x27;)\n      .data(data)\n      .join(&#x27;rect&#x27;)\n      .attr(&#x27;class&#x27;, &#x27;bar&#x27;)\n      .attr(&#x27;x&#x27;, d =&gt; x(d.name))\n      .attr(&#x27;y&#x27;, height)\n      .attr(&#x27;width&#x27;, x.bandwidth())\n      .attr(&#x27;height&#x27;, 0)\n      .transition()\n      .duration(1000)\n      .attr(&#x27;y&#x27;, d =&gt; y(d.value))\n      .attr(&#x27;height&#x27;, d =&gt; height - y(d.value));\n  &lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<h3>3.2 \u5173\u952e\u70b9\u89e3\u6790<\/h3>\n<ul>\n<li><strong>\u6570\u636e\u7ed1\u5b9a<\/strong>\uff1a<code>selectAll().data().join()<\/code> \u662f D3 \u7684\u6838\u5fc3\u6a21\u5f0f\uff0c\u5c06\u6570\u636e\u4e0e DOM \u5143\u7d20\u7ed1\u5b9a\u3002<\/li>\n<li><strong>\u6bd4\u4f8b\u5c3a<\/strong>\uff1a<code>scaleBand<\/code> \u7528\u4e8e\u79bb\u6563\u503c\uff08\u5206\u7c7b\uff09\uff0c<code>scaleLinear<\/code> \u7528\u4e8e\u8fde\u7eed\u503c\u3002<\/li>\n<li><strong>\u8fc7\u6e21\u52a8\u753b<\/strong>\uff1a\u901a\u8fc7 <code>transition()<\/code> \u5b9e\u73b0\u5e73\u6ed1\u52a8\u753b\u3002<\/li>\n<\/ul>\n<p>\ud83d\udca1 <strong>\u6ce8\u610f<\/strong>\uff1aD3 \u7684 <code>join()<\/code> \u65b9\u6cd5\uff08v5.8+\uff09\u7b80\u5316\u4e86 enter\/update\/exit \u6a21\u5f0f\uff0c\u4f46\u7406\u89e3\u5176\u539f\u7406\u4ecd\u5f88\u91cd\u8981\u3002<\/p>\n<h3>3.3 \u6dfb\u52a0\u4ea4\u4e92\uff1a\u9f20\u6807\u60ac\u505c\u663e\u793a\u6570\u503c<\/h3>\n<pre><code class=\"language-javascript\">\nsvg.selectAll(&#x27;.bar&#x27;)\n  .on(&#x27;mouseover&#x27;, function(event, d) {\n    d3.select(this).attr(&#x27;fill&#x27;, &#x27;orange&#x27;);\n    \/\/ \u6dfb\u52a0\u63d0\u793a\u6587\u672c\n    svg.append(&#x27;text&#x27;)\n      .attr(&#x27;class&#x27;, &#x27;tooltip&#x27;)\n      .attr(&#x27;x&#x27;, x(d.name) + x.bandwidth() \/ 2)\n      .attr(&#x27;y&#x27;, y(d.value) - 5)\n      .attr(&#x27;text-anchor&#x27;, &#x27;middle&#x27;)\n      .text(d.value);\n  })\n  .on(&#x27;mouseout&#x27;, function() {\n    d3.select(this).attr(&#x27;fill&#x27;, &#x27;steelblue&#x27;);\n    svg.selectAll(&#x27;.tooltip&#x27;).remove();\n  });\n<\/code><\/pre>\n<h2>\u56db\u3001\u5b9e\u6218\u6848\u4f8b 2\uff1a\u7528 ECharts \u5b9e\u73b0\u4ea4\u4e92\u5730\u56fe<\/h2>\n<h3>4.1 \u73af\u5883\u51c6\u5907<\/h3>\n<p>\u521b\u5efa\u4e00\u4e2a HTML \u6587\u4ef6\uff0c\u5f15\u5165 ECharts \u548c\u5730\u56fe\u6570\u636e\uff1a<\/p>\n<pre><code class=\"language-html\">\n&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n  &lt;meta charset=&quot;utf-8&quot;&gt;\n  &lt;title&gt;ECharts \u4ea4\u4e92\u5730\u56fe&lt;\/title&gt;\n  &lt;script src=&quot;https:\/\/cdn.jsdelivr.net\/npm\/echarts@5.4.3\/dist\/echarts.min.js&quot;&gt;&lt;\/script&gt;\n  &lt;script src=&quot;https:\/\/cdn.jsdelivr.net\/npm\/echarts@5.4.3\/map\/js\/china.js&quot;&gt;&lt;\/script&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n  &lt;div id=&quot;map&quot; style=&quot;width: 800px; height: 600px;&quot;&gt;&lt;\/div&gt;\n  &lt;script&gt;\n    const chart = echarts.init(document.getElementById(&#x27;map&#x27;));\n\n    \/\/ \u6a21\u62df\u6570\u636e\n    const data = [\n      { name: &#x27;\u5317\u4eac&#x27;, value: 100 },\n      { name: &#x27;\u4e0a\u6d77&#x27;, value: 90 },\n      { name: &#x27;\u5e7f\u4e1c&#x27;, value: 80 },\n      { name: &#x27;\u6d59\u6c5f&#x27;, value: 70 },\n      { name: &#x27;\u6c5f\u82cf&#x27;, value: 60 }\n    ];\n\n    const option = {\n      title: {\n        text: &#x27;\u4e2d\u56fd\u5404\u7701\u4efd\u6570\u636e\u5206\u5e03&#x27;,\n        left: &#x27;center&#x27;\n      },\n      tooltip: {\n        trigger: &#x27;item&#x27;,\n        formatter: &#x27;{b}: {c}&#x27;\n      },\n      visualMap: {\n        min: 0,\n        max: 100,\n        left: &#x27;left&#x27;,\n        top: &#x27;bottom&#x27;,\n        text: [&#x27;\u9ad8&#x27;, &#x27;\u4f4e&#x27;],\n        calculable: true,\n        inRange: {\n          color: [&#x27;#e0f3f8&#x27;, &#x27;#ffffbf&#x27;, &#x27;#fdae61&#x27;, &#x27;#f46d43&#x27;, &#x27;#d73027&#x27;]\n        }\n      },\n      series: [\n        {\n          name: &#x27;\u6570\u636e&#x27;,\n          type: &#x27;map&#x27;,\n          map: &#x27;china&#x27;,\n          roam: true,\n          label: {\n            show: true,\n            fontSize: 10\n          },\n          data: data\n        }\n      ]\n    };\n\n    chart.setOption(option);\n\n    \/\/ \u54cd\u5e94\u5f0f\n    window.addEventListener(&#x27;resize&#x27;, () =&gt; chart.resize());\n  &lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<h3>4.2 \u5173\u952e\u70b9\u89e3\u6790<\/h3>\n<ul>\n<li><strong>\u5730\u56fe\u6570\u636e<\/strong>\uff1aECharts \u9700\u8981\u5f15\u5165\u5730\u56fe\u7684 GeoJSON \u6570\u636e\uff0cchina.js \u662f\u5b98\u65b9\u63d0\u4f9b\u7684\u4e2d\u56fd\u5730\u56fe\u6570\u636e\u3002<\/li>\n<li><strong>visualMap<\/strong>\uff1a\u89c6\u89c9\u6620\u5c04\u7ec4\u4ef6\uff0c\u5c06\u6570\u636e\u503c\u6620\u5c04\u5230\u989c\u8272\u3002<\/li>\n<li><strong>roam<\/strong>\uff1a\u5f00\u542f\u7f29\u653e\u548c\u62d6\u62fd\u3002<\/li>\n<\/ul>\n<p>\ud83d\udca1 <strong>\u6ce8\u610f<\/strong>\uff1aECharts 5 \u9ed8\u8ba4\u4f7f\u7528 Canvas \u6e32\u67d3\uff0c\u5bf9\u4e8e\u5927\u6570\u636e\u91cf\u5730\u56fe\u5efa\u8bae\u5f00\u542f <code>large: true<\/code> \u6216\u4f7f\u7528 <code>progressive<\/code> \u6e10\u8fdb\u6e32\u67d3\u3002<\/p>\n<h3>4.3 \u6dfb\u52a0\u70b9\u51fb\u4e8b\u4ef6<\/h3>\n<pre><code class=\"language-javascript\">\nchart.on(&#x27;click&#x27;, function(params) {\n  alert(`\u4f60\u70b9\u51fb\u4e86 ${params.name}\uff0c\u6570\u503c\u4e3a ${params.value}`);\n});\n<\/code><\/pre>\n<h2>\u4e94\u3001\u9009\u578b\u51b3\u7b56\u6811\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h2>\n<h3>5.1 \u9009\u578b\u51b3\u7b56\u6811<\/h3>\n<pre><code>\n\u662f\u5426\u9700\u8981\u9ad8\u5ea6\u5b9a\u5236\u5316\u7684\u53ef\u89c6\u5316\uff1f\n\u251c\u2500\u2500 \u662f \u2192 \u9009\u62e9 D3.js\n\u2502   \u251c\u2500\u2500 \u6570\u636e\u91cf\u662f\u5426\u8d85\u8fc7 1 \u4e07\u6761\uff1f\n\u2502   \u2502   \u251c\u2500\u2500 \u662f \u2192 \u4f7f\u7528 D3.js + Canvas \u6e32\u67d3\n\u2502   \u2502   \u2514\u2500\u2500 \u5426 \u2192 \u4f7f\u7528 D3.js + SVG \u6e32\u67d3\n\u2502   \u2514\u2500\u2500 \u662f\u5426\u9700\u8981\u590d\u6742\u4ea4\u4e92\uff1f\n\u2502       \u251c\u2500\u2500 \u662f \u2192 \u7ed3\u5408 D3.js \u548c\u6846\u67b6\uff08\u5982 React\uff09\u7ba1\u7406\u72b6\u6001\n\u2502       \u2514\u2500\u2500 \u5426 \u2192 \u76f4\u63a5\u4f7f\u7528 D3.js\n\u2514\u2500\u2500 \u5426 \u2192 \u9009\u62e9 ECharts\n    \u251c\u2500\u2500 \u662f\u5426\u9700\u8981 3D \u6216 WebGL\uff1f\n    \u2502   \u251c\u2500\u2500 \u662f \u2192 ECharts GL\n    \u2502   \u2514\u2500\u2500 \u5426 \u2192 \u6807\u51c6 ECharts\n    \u2514\u2500\u2500 \u662f\u5426\u9700\u8981\u79fb\u52a8\u7aef\u9002\u914d\uff1f\n        \u251c\u2500\u2500 \u662f \u2192 \u4f7f\u7528 ECharts \u7684\u79fb\u52a8\u7aef\u4f18\u5316\u914d\u7f6e\n        \u2514\u2500\u2500 \u5426 \u2192 \u9ed8\u8ba4\u914d\u7f6e\n<\/code><\/pre>\n<h3>5.2 \u6700\u4f73\u5b9e\u8df5<\/h3>\n<ol>\n<li><strong>\u6309\u9700\u5f15\u5165<\/strong>\uff1a\u65e0\u8bba\u662f D3 \u8fd8\u662f ECharts\uff0c\u90fd\u652f\u6301\u6309\u9700\u5f15\u5165\u4ee5\u51cf\u5c11\u5305\u4f53\u79ef\u3002\u4f8b\u5982 ECharts \u53ef\u4ee5\u53ea\u5f15\u5165\u9700\u8981\u7684\u56fe\u8868\u7c7b\u578b\u548c\u7ec4\u4ef6\u3002<\/li>\n<li><strong>\u6027\u80fd\u4f18\u5316<\/strong>\uff1a\u5927\u6570\u636e\u91cf\u65f6\uff0cD3 \u4f18\u5148\u4f7f\u7528 Canvas\uff0cECharts \u5f00\u542f <code>large<\/code> \u6a21\u5f0f\u6216\u4f7f\u7528 <code>dataset<\/code> \u7ba1\u7406\u6570\u636e\u3002<\/li>\n<li><strong>\u54cd\u5e94\u5f0f\u8bbe\u8ba1<\/strong>\uff1a\u76d1\u542c\u7a97\u53e3 resize \u4e8b\u4ef6\uff0c\u8c03\u7528 <code>chart.resize()<\/code>\uff08ECharts\uff09\u6216\u91cd\u65b0\u8ba1\u7b97\u6bd4\u4f8b\u5c3a\uff08D3\uff09\u3002<\/li>\n<li><strong>\u53ef\u8bbf\u95ee\u6027<\/strong>\uff1a\u4e3a\u56fe\u8868\u6dfb\u52a0 <code>aria-label<\/code>\uff0cD3 \u53ef\u4ee5\u65b9\u4fbf\u5730\u64cd\u4f5c DOM \u6dfb\u52a0\u65e0\u969c\u788d\u5c5e\u6027\u3002<\/li>\n<li><strong>\u6d4b\u8bd5<\/strong>\uff1a\u4f7f\u7528\u622a\u56fe\u6d4b\u8bd5\uff08\u5982 Jest + Puppeteer\uff09\u786e\u4fdd\u56fe\u8868\u6e32\u67d3\u6b63\u786e\u3002<\/li>\n<\/ol>\n<h2>\u516d\u3001\u603b\u7ed3<\/h2>\n<ul>\n<li><strong>D3.js<\/strong> \u9002\u5408\u9700\u8981\u9ad8\u5ea6\u5b9a\u5236\u3001\u975e\u6807\u51c6\u53ef\u89c6\u5316\u7684\u573a\u666f\uff0c\u4f46\u5b66\u4e60\u6210\u672c\u9ad8\u3001\u5f00\u53d1\u6548\u7387\u4f4e\u3002<\/li>\n<li><strong>ECharts<\/strong> \u9002\u5408\u5feb\u901f\u5b9e\u73b0\u6807\u51c6\u56fe\u8868\uff0c\u914d\u7f6e\u7b80\u5355\u3001\u6027\u80fd\u4f18\u79c0\uff0c\u4f46\u5b9a\u5236\u80fd\u529b\u6709\u9650\u3002<\/li>\n<li>\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u6df7\u5408\u4f7f\u7528\uff1a\u7528 ECharts \u5feb\u901f\u642d\u5efa\u57fa\u7840\u56fe\u8868\uff0c\u7528 D3.js \u5b9e\u73b0\u7279\u6b8a\u6548\u679c\u3002<\/li>\n<\/ul>\n<p><strong>\u5ef6\u4f38\u9605\u8bfb<\/strong>\uff1a<\/p>\n<ul>\n<li>D3.js \u5b98\u65b9\u6587\u6863\uff1ahttps:\/\/d3js.org<\/li>\n<li>ECharts \u5b98\u65b9\u6587\u6863\uff1ahttps:\/\/echarts.apache.org<\/li>\n<li>\u300aD3.js \u6570\u636e\u53ef\u89c6\u5316\u5b9e\u6218\u300b<\/li>\n<li>\u300aECharts \u6570\u636e\u53ef\u89c6\u5316\uff1a\u5165\u95e8\u3001\u5b9e\u6218\u4e0e\u8fdb\u9636\u300b<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u9762\u5bf9\u4f17\u591a\u53ef\u89c6\u5316\u5e93\uff0c\u5982\u4f55\u9009\u62e9 D3.js \u8fd8\u662f ECharts\uff1f\u672c\u6587\u4ece\u67b6\u6784\u3001\u6027\u80fd\u3001\u5f00\u53d1\u6548\u7387\u7b49\u7ef4\u5ea6\u6df1\u5ea6\u5bf9\u6bd4\uff0c\u5e76\u901a\u8fc7\u4e24\u4e2a\u5b9e\u6218\u6848\u4f8b\uff08\u52a8\u6001\u67f1\u72b6\u56fe\u4e0e\u4ea4\u4e92\u5730\u56fe\uff09\u6f14\u793a\u6838\u5fc3\u7528\u6cd5\uff0c\u6700\u540e\u7ed9\u51fa\u9009\u578b\u51b3\u7b56\u6811\u548c\u6700\u4f73\u5b9e\u8df5\uff0c\u52a9\u4f60\u5feb\u901f\u843d\u5730\u6570\u636e\u53ef\u89c6\u5316\u9700\u6c42\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[51,52,37,36,53],"class_list":["post-307","post","type-post","status-publish","format-standard","hentry","category-3","category-4","tag-d3-js","tag-echarts","tag-javascript","tag-36","tag-53"],"_links":{"self":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts\/307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=307"}],"version-history":[{"count":0,"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts\/307\/revisions"}],"wp:attachment":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}