91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

vue2?利用echarts單獨繪制省份的步驟是什么

發布時間:2022-01-24 09:14:41 來源:億速云 閱讀:146 作者:kk 欄目:開發技術

這期內容當中小編將會給大家帶來有關vue2 利用echarts單獨繪制省份的步驟是什么,文章內容豐富且以專業的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

第一步:先引入所需的第三方模塊

import echarts from "echarts"; // 引入所需要的echarts模塊
import "echarts/map/js/province/shanxi"; // 引入省份的js文件
import "echarts/map/json/province/shanxi.json"; // 引入省份的json文件

第二步:開始繪制

// 基于準備好的dom,初始化echarts實例
      var myChart = echarts.init(document.getElementById("left2"));

      var option = {
        visualMap: {
          show: false,
          min: 0,
          max: 100,
          left: "left",
          top: "bottom",
          text: ["高", "低"], // 文本,默認為數值文本
          calculable: true,
          inRange: {
            color: ["yellow", "lightskyblue", "orangered"],
          },
        },
        series: [
          {
            layoutCenter: ['30%', '30%'],
            type: "map",
            mapType: "山西",
            roam: true,
            label: {
              normal: {
                show: true,
                textStyle: {
                  fontSize: 10,
                  fontFamily: "楷體",
                },
              },
              emphasis: {
                  color: "#fff",
            },
            itemStyle: {
                borderColor: "#389BB7",
                areaColor: "#fff",
                areaColor: "#389BB7",
                borderWidth: 0,
            animation: false,// 數據
            data: [
              {
                name: "大同市",
                value: 88,
                name: "朔州市",
                value: 96,
                name: "忻州市",
                value: 98,
                name: "呂梁市",
                value: 80,
                name: "太原市",
                name: "晉中市",
                value: 79,
                name: "陽泉市",
                value: 77,
                name: "臨汾市",
                value: 33,
                name: "長治市",
                value: 69,
                name: "運城市",
                value: 66,
                name: "晉城市",
                value: 22,
            ],
        ],
      };
      myChart.setOption(option);

最后結果:

vue2?利用echarts單獨繪制省份的步驟是什么

補充:vue2.x結合echarts2實現顯示具體省份熱力圖

最近研究了一下VUE2.X結合ehcarts實現熱力圖,先看下最終:

vue2?利用echarts單獨繪制省份的步驟是什么

效果話不多說,直接上代碼:

<!DOCTYPE html>
<html>
<head>
    <title>test</title>
    <meta charset="utf-8">
    <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts.min.js"></script>
    <!-- <script type="text/javascript" src="./china.js"></script> -->
    <script type="text/javascript" src="./xinjiang.js"></script>
    <style type="text/css">
        #myChart{
            width: 500px;
            height: 500px;
        }
    </style>
</head>
<body>
    <div id="myChart"></div>
</body>
<script type="text/javascript">

var geoCoordMap = {
    "烏魯木齊":[87.68,43.77],
    "克拉瑪依":[84.77,45.59],
    "石河子":[85.94,44.27],
    "吐魯番":[89.19,42.91],
    "齊齊哈爾":[123.97,47.33],
    "托克遜":[88.63,42.77],
    "鄯善":[90.25,42.82],
    "哈密":[93.44,42.78],
    "伊吾":[94.65,43.28],
    "巴里坤":[93,43.6],
    "庫爾勒":[86.06,41.68],
    "和靜":[86.35,42.31],
    "和碩":[86.84,42.23],
    "博湖":[86.53,41.95],
    "尉梨":[86.24,41.36],
    "輪臺":[84.25,41.77],
    "焉耆":[86.55,42.05],
    "和田":[79.94,37.12],
    "民豐":[82.63,37.07],
    "策勒":[80.78,37.04],
    "于田":[81.63,36.86],
    "洛浦":[80.17,37.12],
    "皮山":[78.29,37.06],
    "墨玉":[79.74,37.31],
    "阿克蘇":[80.29,41.15],
    "溫宿":[80.24,41.29],
    "拜城":[81.84,41.82],
    "庫車":[82.97,41.68],
    "新和":[82.63,41.55],
    "沙雅":[82.9,41.25],
    "阿瓦提":[80.34,40.64],
    "柯平":[79.06,40.55],
    "烏什":[79.25,41.22],
    "咯什":[75.94,39.52],
    "巴楚":[78.59,39.78],
    "枷師":[76.78,39.46],
    "樂普湖":[76.67,39.23],
    "麥蓋提":[77.62,38.95],
    "莎車":[77.25,38.45],
    "澤普":[77.26,38.2],
    "葉城":[77.42,37.89],
    "疏勒":[76.05,39.41],
    "英吉沙":[76.17,38.91],
    "疏附":[75.83,39.42],
    "塔什庫爾干":[75.22,75.22],
    "阿圖什":[76.12,39.73],
    "阿合奇":[78.42,41.91],
    "阿克陶":[75.94,39.14],
    "烏恰":[75.18,39.7],
    "昌吉":[87.31,44.05],
    "阜康":[87.94,44.14],
    "奇臺":[89.52,44.02],
    "吉木薩爾":[89.14,44],
    "米泉":[87.68,43.97],
    "瑪納斯":[86.22,44.28],
    "呼圖壁":[86.92,44.18],
    "木壘":[90.34,43.8],
    "博樂":[82.1,44.93],
    "精河":[82.92,44.67],
    "溫泉":[81.08,44.95],
    "伊寧":[81.33,43.91],
    "尼勒克":[82.53,43.82],
    "新源":[83.27,43.41],
    "鞏留":[82.23,43.35],
    "奎屯":[84.89,44.45],
    "特克斯":[81.81,43.23],
    "昭蘇":[81.08,43.15],
    "霍城":[80.87,44.07],
    "察布察爾":[81.12,43.82],
    "塔城":[82.96,46.74],
    "額敏":[83.62,46.52],
    "烏蘇":[84.62,44.45],
    "托里":[83.59,45.92],
    "裕民":[82.94,46.21],
    "沙灣":[85.56,44.29],
    "和布克賽爾":[85.13,46.78],
    "阿勒泰":[88.14,47.86],
    "青河":[90.37,46.71],
    "富蘊":[89.44,47.05],
    "福海":[87.51,47.15],
    "吉木乃":[85.84,47.42],
    "布爾津":[86.92,47.7],
    "哈巴河":[86.41,48.05]
};
var convertData = function (data) {
    var res = [];
    for (var i = 0; i < data.length; i++) {
        var geoCoord = geoCoordMap[data[i].name];
        if (geoCoord) {
            res.push(geoCoord.concat(data[i].value));
    }
    return res;
var loadData = convertData([
    {name: "烏魯木齊", value: 32112},
    {name: "克拉瑪依", value: 44412},
    {name: "石河子", value: 25123},
    {name: "吐魯番", value: 45612},
    {name: "齊齊哈爾", value: 12512},
    {name: "托克遜", value: 12512},
    {name: "鄯善", value: 25121},
    {name: "哈密", value: 54425},
    {name: "伊吾", value: 54126},
    {name: "巴里坤", value: 5226},
    {name: "庫爾勒", value: 56247},
    {name: "和靜", value: 67227},
    {name: "和碩", value: 35427},
    {name: "博湖", value: 78327},
    {name: "尉梨", value: 87628},
    {name: "輪臺", value: 87629},
    {name: "焉耆", value: 67830},
    {name: "和田", value: 98730},
    {name: "民豐", value: 112331},
    {name: "策勒", value: 113331},
    {name: "于田", value: 132331},
    {name: "洛浦", value: 123231},
    {name: "皮山", value: 154132},
    {name: "墨玉", value: 56632},
    {name: "阿克蘇", value: 23232},
    {name: "溫宿", value: 12333},
    {name: "拜城", value: 22333},
    {name: "庫車", value: 32333},
    {name: "新和", value: 43434},
    {name: "沙雅", value: 54534},
    {name: "阿瓦提", value: 64535},
    {name: "柯平", value: 65435},
    {name: "烏什", value: 567236},
    {name: "咯什", value: 567336},
    {name: "巴楚", value: 67836},
    {name: "枷師", value: 789436},
    {name: "樂普湖", value: 898236},
    {name: "麥蓋提", value: 678437},
    {name: "莎車", value: 56737},
    {name: "澤普", value: 123337},
    {name: "葉城", value: 12337},
    {name: "英吉沙", value: 23437},
    {name: "疏附", value: 34538},
    {name: "阿圖什", value: 34568},
    {name: "阿合奇", value: 12138},
    {name: "阿克陶", value: 32138},
    {name: "瑪納斯", value: 54139},
    {name: "哈巴河", value: 56139},
    {name: "布爾津", value: 67139},
    {name: "吉木乃", value: 78139},
    {name: "福海", value: 65440},
    {name: "富蘊", value: 32340},
    {name: "青河", value: 44341},
    {name: "阿勒泰", value: 54341},
    {name: "和布克賽爾", value: 23442},
    {name: "裕民", value: 12343},
    {name: "沙灣", value: 22343}
]);
option = {
    backgroundColor: '#404a59',
    xAxis: {
        show: false
    },
    yAxis: {
    visualMap: {
        type: 'piecewise',
        min: 20000,
        max: 100000,
        calculable: true,
        realtime: false,
        splitNumber: 5,
        inRange: {
            color: ['#005a88', '#04a4f6', '#00943e', '#fdf40f', '#cf2d14']
        },
        right: '10%',
        bottom: '5%',
        orient:"vertical1",
        inverse:true,  //是否反轉 visualMap 組件
        textStyle: {
            color: '#fff'
    geo: { // 這個是重點配置區
      map: '新疆', // 表示中國地圖
      roam: true,
      itemStyle: {
        normal: {
          areaColor: '#081832',
          borderColor: '#425F91'
        emphasis: {
          areaColor: "#2a333d",
          shadowOffsetX: 0,
          shadowOffsetY: 0,
          shadowBlur: 20,
          borderWidth: 0,
          shadowColor: 'rgba(0, 0, 0, 0.5)'
      },
      silent: true
    series: [{
        name: '',
        type: 'heatmap',
        data: loadData,
        coordinateSystem: 'geo',
        progressive: 1000,
        animation: false
    }]
var lineChart = echarts.init(document.getElementById('myChart'));
lineChart.setOption(option);
</script>
</html>

   說一下:china.js或各個省份對應的js文件在node包里面就有,是比較全面的。有的說這里沒有用到VUE啊,對的,在這里沒引入(那是我的項目額!),不過不用擔心,因為vue里面直接引入是完全兼容的啦! 

  代碼看似很簡單,但是里面的坑很多。因為我是在項目中直接使用的,本來想著有node包,就沒有引入china.js或者具體省份對應的js文件,造成一些問題。第二個就是關于坐標軸、網格的設置,有些設置是相關聯的,要注意。第三個就是在網上自行找到新疆省份下各個區鎖對應的經緯度(這個渠道很多,就不多啰嗦了)。第四個就是在visualMap中的設置。

Vue的優點

Vue具體輕量級框架、簡單易學、雙向數據綁定、組件化、數據和結構的分離、虛擬DOM、運行速度快等優勢,Vue中頁面使用的是局部刷新,不用每次跳轉頁面都要請求所有數據和dom,可以大大提升訪問速度和用戶體驗。

上述就是小編為大家分享的vue2 利用echarts單獨繪制省份的步驟是什么了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關知識,歡迎關注億速云行業資訊頻道。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

庆安县| 宝坻区| 盐边县| 稻城县| 遂溪县| 合川市| 郯城县| 平谷区| 肇州县| 汶川县| 收藏| 扶余县| 乌拉特前旗| 卢湾区| 松滋市| 老河口市| 娄底市| 沅陵县| 江津市| 那曲县| 伽师县| 金川县| 原阳县| 盐源县| 阿克陶县| 巴林右旗| 固始县| 蓬溪县| 麻栗坡县| 马关县| 巴马| 宿州市| 鱼台县| 鄯善县| 吐鲁番市| 屏东县| 昭通市| 兴义市| 邹平县| 江山市| 乌鲁木齐市|