<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 地理圖 ## 需求 繪制一張世界地圖 ## 分析 首先我們需要地圖數據 目前d3支持[geojson](https://tools.ietf.org/html/rfc7946)格式化數據。d3的發起人[mbostock](https://github.com/mbostock)同時構建的了[topojson](https://github.com/topojson/topojson),可以將geojson減少80%以上的大小。可以將topojson轉化為geojson。 繪制思路: 1. 我們需要將topojson轉化為geojson,由于這是獨立庫不在d3中包含,所以需要單獨引入。 2. 將topojson數據處理為geojson 3. 需要使用d3.geoPath()來繪制,d3提供多種投影,所以我們需要選用適合的投影方式。 4. 需要將數據綁定到path,調用geoPath進行繪制即可。 ## 繪制 ``` javascript //創建svg var svg = d3.select('#root') .append('svg') .attr('width', 1200) .attr('height', 600) .style("background-color","rgb(142, 137, 137)"); var margin=[100,100,100,100] var color = d3.scaleOrdinal(d3.schemeCategory20) var projection = d3.geoEquirectangular() //圓柱平面投影 var path = d3.geoPath(projection) var Graticule = d3.geoGraticule()//創建經緯線 d3.json('./world.json',function(error,world){ if (error) throw error; dataSet = topojson.mesh(world) console.log(dataSet) svg.insert("path", ".graticule") .datum(dataSet) .attr("d", path) .attr('fill','none') .attr('stroke','#000') }) ``` ## 實例 [geo0](https://doter1995.github.io/d3-start-course/geo/geo-0.html) ![](https://box.kancloud.cn/6e4ee508abb6bb29e6ba93c65f49c27e_1008x514.png) [地球儀](https://doter1995.github.io/d3/charts/geo/)使用geoOrthographic投影 ![](https://box.kancloud.cn/de0193307b81c91f6afe102683316b3e_631x512.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看