{"id":52403,"date":"2024-12-03T09:28:56","date_gmt":"2024-12-03T01:28:56","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52403\/"},"modified":"2024-12-03T09:28:56","modified_gmt":"2024-12-03T01:28:56","slug":"%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8-echarts-gl-%e5%ba%93%e5%88%9b%e5%bb%ba%e5%8f%91%e5%85%89%e7%9a%84-3d-%e5%9b%be%e6%a0%87%ef%bc%9f-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52403\/","title":{"rendered":"\u5982\u4f55\u5229\u7528 ECharts-GL \u5e93\u521b\u5efa\u53d1\u5149\u7684 3D \u56fe\u6807\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u5229\u7528 ECharts-GL \u5e93\u521b\u5efa\u53d1\u5149\u7684 3D \u56fe\u6807\uff1f <\/h1>\n<p>\u4eca\u65e5\u4e0d\u80af\u57cb\u5934\uff0c\u660e\u65e5\u4f55\u4ee5\u62ac\u5934\uff01\u6bcf\u65e5\u4e00\u53e5\u52aa\u529b\u81ea\u5df1\u7684\u8bdd\u54c8\u54c8~\u54c8\u55bd\uff0c\u4eca\u5929\u6211\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5982\u4f55\u5229\u7528 ECharts-GL \u5e93\u521b\u5efa\u53d1\u5149\u7684 3D \u56fe\u6807\uff1f \u300b<\/span>\uff0c\u4e3b\u8981\u5185\u5bb9\u662f\u8bb2\u89e3<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u53ef\u4ee5\u6536\u85cf\u6216\u8005\u6709\u66f4\u597d\u7684\u5efa\u8bae\u5728\u8bc4\u8bba\u63d0\u51fa\uff0c\u6211\u90fd\u4f1a\u8ba4\u771f\u770b\u7684\uff01\u5927\u5bb6\u4e00\u8d77\u8fdb\u6b65\uff0c\u4e00\u8d77\u5b66\u4e60\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241120\/1732087123673d8d53d4e28.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5229\u7528 ECharts-GL \u5e93\u521b\u5efa\u53d1\u5149\u7684 3D \u56fe\u6807\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5229\u7528 ECharts-GL \u5e93\u521b\u5efa\u53d1\u5149\u7684 3D \u56fe\u6807\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 ECharts \u521b\u5efa\u7c7b\u4f3c\u4e8e 3D \u53d1\u5149\u7684\u56fe\u6807<\/strong><\/p>\n<p>\u8fd9\u9879\u7279\u6b8a\u56fe\u6807\u7684\u521b\u5efa\u6d89\u53ca\u4f7f\u7528 ECharts-GL \u5e93\uff0c\u8fd9\u662f\u4e00\u4e2a\u9644\u52a0\u5e93\uff0c\u4e13\u95e8\u7528\u4e8e\u6269\u5c55 ECharts \u7684 3D \u56fe\u8868\u529f\u80fd\u3002<\/p>\n<p><strong>\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/strong><\/p>\n<ol>\n<li>\n<p>\u5b89\u88c5 ECharts-GL \u5e93\uff1a<\/p>\n<pre>npm install echarts-gl<\/pre>\n<\/li>\n<li>\n<p>\u5728\u4ee3\u7801\u4e2d\u5bfc\u5165 ECharts-GL\uff1a<\/p>\n<pre>import * as echarts from 'echarts\/core';\nimport 'echarts-gl';  \/\/ \u5f15\u5165ECharts-GL<\/pre>\n<\/li>\n<li>\n<p>\u521b\u5efa WebGL \u6e32\u67d3\u5668\uff1a<\/p>\n<pre>\/\/ \u521b\u5efaWebGL\u6e32\u67d3\u5668\nconst renderer = echarts.renderer['webgl'];<\/pre>\n<\/li>\n<li>\n<p>\u8bbe\u7f6e Renderer \u548c Camera \u89c6\u56fe\u63a7\u5236\u5668\u7684\u9009\u9879\uff1a<\/p>\n<pre>\/\/ \u8bbe\u7f6e\u6e32\u67d3\u5668\u7684\u9009\u9879\nconst rendererOpts = {\n  \/\/ \u706f\u5149\u914d\u7f6e\n  lights: [\n {\n   type: 'ambient', \/\/ \u73af\u5883\u5149\n   intensity: 0.8\n },\n {\n   type: 'directional', \/\/ \u5e73\u884c\u5149\n   intensity: 0.5,\n   normal: [0.5, 1, 0.5] \/\/ \u5e73\u884c\u5149\u7684\u65b9\u5411\uff0c\u786e\u4fdd\u4e86\u5149\u4ece\u6444\u50cf\u673a\u5411\u5916\u6295\u5c04\n }\n  ],\n  terrain: {\n downsampling: 512, \/\/ \u6307\u5b9a\u91c7\u6837\u7684\u6570\u91cf\n maxTileSize: 128  \/\/ \u6307\u5b9a\u5207\u7247\u7684\u6700\u5927\u5927\u5c0f\n  },\n  fog: {\n type: 'exponential', \/\/ \u6307\u5b9a\u96fe\u7684\u7c7b\u578b\uff0c\u6b64\u5904\u4e3a\u6307\u6570\u96fe\n color: 'rgba(0,0,0,0.5)', \/\/ \u6307\u5b9a\u96fe\u7684\u989c\u8272\n near: 100, \/\/ \u6307\u5b9a\u96fe\u7684\u8fd1\u8fb9\u754c\u8ddd\u79bb\n far: 2000 \/\/ \u6307\u5b9a\u96fe\u7684\u8fdc\u8fb9\u754c\u8ddd\u79bb\n  }\n};\n\n\/\/ \u521b\u5efa\u6e32\u67d3\u5668\nconst renderer = new renderer.WebGLRenderer(rendererOpts);\n\n\/\/ \u8bbe\u7f6e\u76f8\u673a\u89c6\u56fe\u63a7\u5236\u5668\u7684\u9009\u9879\nconst viewControlOpts = {\n  projection: 'perspective',  \/\/ \u6307\u5b9a\u6295\u5f71\u7c7b\u578b\uff0c\u6b64\u5904\u4e3a\u900f\u89c6\u6295\u5f71\n  fov: 40, \/\/ \u6307\u5b9a\u89c6\u91ce\u89d2\uff0c\u5355\u4f4d\u4e3a\u5ea6\n  near: 60, \/\/ \u6307\u5b9a\u76f8\u673a\u8fd1\u5e73\u9762\u7684\u8ddd\u79bb\n  far: 2000, \/\/ \u6307\u5b9a\u76f8\u673a\u8fdc\u5e73\u9762\u7684\u8ddd\u79bb\n  zAxis: 1,  \/\/ \u6307\u5b9a\u7528\u4e8ez\u8f74\u65cb\u8f6c\u7684\u65b9\u5411\uff0c\u6b64\u5904\u4e3a y \u8f74\n  maxPitch: 60, \/\/ \u6307\u5b9a\u6700\u5927\u7684\u4fef\u4ef0\u89d2\u9650\u5236\uff0c\u907f\u514d\u4fef\u4ef0\u8d85\u8fc7\u89c4\u5b9a\u5ea6\u6570\n  minPitch: -40, \/\/ \u6307\u5b9a\u6700\u5c0f\u7684\u4fef\u4ef0\u89d2\u9650\u5236\uff0c\u907f\u514d\u4fef\u4ef0\u4f4e\u4e8e\u89c4\u5b9a\u5ea6\u6570\n  distanceMin: 60, \/\/ \u6307\u5b9a\u76f8\u673a\u5230\u573a\u666f\u5b9e\u9645\u6700\u5c0f\u8ddd\u79bb\u9650\u5236\n  distanceMax: 2000, \/\/ \u6307\u5b9a\u76f8\u673a\u5230\u573a\u666f\u5b9e\u9645\u6700\u5927\u8ddd\u79bb\u9650\u5236\n  target: [0, 0, 0] \/\/ \u6307\u5b9a\u76f8\u673a\u7684\u76ee\u6807\u70b9\n};\n\n\/\/ \u521b\u5efa\u76f8\u673a\u89c6\u56fe\u63a7\u5236\u5668\nconst viewControl = new renderer.ViewControl(viewControlOpts);<\/pre>\n<\/li>\n<\/ol>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u5982\u4f55\u5229\u7528 ECharts-GL \u5e93\u521b\u5efa\u53d1\u5149\u7684 3D \u56fe\u6807\uff1f \u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u5427\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   ant-design-vue\u4e2d\u5982\u4f55\u89e3\u51b3\u6298\u53e0\u9762\u677f\u5185a-radio-group\u88ab\u8bc6\u522b\u4e3a\u5b50\u9762\u677f\u7684\u95ee\u9898\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5229\u7528 ECharts-GL \u5e93\u521b\u5efa\u53d1\u5149\u7684 3D \u56fe\u6807\uff1f \u4eca\u65e5\u4e0d\u80af\u57cb\u5934\uff0c\u660e\u65e5\u4f55\u4ee5\u62ac\u5934\uff01\u6bcf\u65e5\u4e00\u53e5\u52aa\u529b\u81ea\u5df1\u7684\u8bdd\u54c8\u54c8~\u54c8\u55bd\uff0c\u4eca\u5929\u6211\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7\u300a\u5982\u4f55\u5229\u7528 ECharts-GL \u5e93\u521b\u5efa\u53d1\u5149\u7684 3D \u56fe\u6807\uff1f \u300b\uff0c\u4e3b\u8981\u5185\u5bb9\u662f\u8bb2\u89e3\u7b49\u7b49\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u53ef\u4ee5\u6536\u85cf\u6216\u8005\u6709\u66f4\u597d\u7684\u5efa\u8bae\u5728\u8bc4\u8bba\u63d0\u51fa\uff0c\u6211\u90fd\u4f1a\u8ba4\u771f\u770b\u7684\uff01\u5927\u5bb6\u4e00\u8d77\u8fdb\u6b65\uff0c\u4e00\u8d77\u5b66\u4e60\uff01 \u5982\u4f55\u4f7f\u7528 ECharts \u521b\u5efa\u7c7b\u4f3c\u4e8e 3D \u53d1\u5149\u7684\u56fe\u6807 \u8fd9\u9879\u7279\u6b8a\u56fe\u6807\u7684\u521b\u5efa\u6d89\u53ca\u4f7f\u7528 ECharts-GL \u5e93\uff0c\u8fd9\u662f\u4e00\u4e2a\u9644\u52a0\u5e93\uff0c\u4e13\u95e8\u7528\u4e8e\u6269\u5c55 ECharts \u7684 3D \u56fe\u8868\u529f\u80fd\u3002 \u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a \u5b89\u88c5 ECharts-GL \u5e93\uff1a npm install echarts-gl \u5728\u4ee3\u7801\u4e2d\u5bfc\u5165 ECharts-GL\uff1a import * as echarts from &#8216;echarts\/core&#8217;; import &#8216;echarts-gl&#8217;; \/\/ \u5f15\u5165ECharts-GL \u521b\u5efa WebGL \u6e32\u67d3\u5668\uff1a \/\/ \u521b\u5efaWebGL\u6e32\u67d3\u5668 const renderer = echarts.renderer[&#8216;webgl&#8217;]; \u8bbe\u7f6e Renderer \u548c Camera [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-52403","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=52403"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52403\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}